Class GraphExploreRequest

All Implemented Interfaces:
IndicesRequest, IndicesRequest.Replaceable, Writeable, org.elasticsearch.core.RefCounted, TaskAwareRequest, TransportRequest, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject

public class GraphExploreRequest extends LegacyActionRequest implements IndicesRequest.Replaceable, org.elasticsearch.xcontent.ToXContentObject
Holds the criteria required to guide the exploration of connected terms which can be returned as a graph.
  • Field Details

  • Constructor Details

    • GraphExploreRequest

      public GraphExploreRequest()
    • GraphExploreRequest

      public GraphExploreRequest(String... indices)
      Constructs a new graph request to run against the provided indices. No indices means it will run against all indices.
    • GraphExploreRequest

      public GraphExploreRequest(StreamInput in) throws IOException
      Throws:
      IOException
  • Method Details

    • validate

      Specified by:
      validate in class ActionRequest
    • indices

      public String[] indices()
      Specified by:
      indices in interface IndicesRequest
    • allowsRemoteIndices

      public boolean allowsRemoteIndices()
      Specified by:
      allowsRemoteIndices in interface IndicesRequest.Replaceable
    • indices

      public GraphExploreRequest indices(String... indices)
      Specified by:
      indices in interface IndicesRequest.Replaceable
    • indicesOptions

      public IndicesOptions indicesOptions()
      Specified by:
      indicesOptions in interface IndicesRequest
    • includeDataStreams

      public boolean includeDataStreams()
      Specified by:
      includeDataStreams in interface IndicesRequest
    • indicesOptions

      public GraphExploreRequest indicesOptions(IndicesOptions indicesOptions)
    • routing

      public String routing()
    • routing

      public GraphExploreRequest routing(String routing)
    • routing

      public GraphExploreRequest routing(String... routings)
    • timeout

      public org.elasticsearch.core.TimeValue timeout()
    • timeout

      public GraphExploreRequest timeout(org.elasticsearch.core.TimeValue timeout)
      Graph exploration can be set to timeout after the given period. Search operations involved in each hop are limited to the remaining time available but can still overrun due to the nature of their "best efforts" timeout support. When a timeout occurs partial results are returned.
      Parameters:
      timeout - a TimeValue object which determines the maximum length of time to spend exploring
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Overrides:
      writeTo in class ActionRequest
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class AbstractTransportRequest
    • sampleSize

      public void sampleSize(int maxNumberOfDocsPerHop)
      The number of top-matching documents that are considered during each hop (default is SamplerAggregationBuilder.DEFAULT_SHARD_SAMPLE_SIZE Very small values (less than 50) may not provide sufficient weight-of-evidence to identify significant connections between terms.

      Very large values (many thousands) are not recommended with loosely defined queries (fuzzy queries or those with many OR clauses). This is because any useful signals in the best documents are diluted with irrelevant noise from low-quality matches. Performance is also typically better with smaller samples as there are less look-ups required for background frequencies of terms found in the documents

      Parameters:
      maxNumberOfDocsPerHop - shard-level sample size in documents
    • sampleSize

      public int sampleSize()
    • sampleDiversityField

      public void sampleDiversityField(String name)
      Optional choice of single-value field on which to diversify sampled search results
    • sampleDiversityField

      public String sampleDiversityField()
    • maxDocsPerDiversityValue

      public void maxDocsPerDiversityValue(int maxDocs)
      Optional number of permitted docs with same value in sampled search results. Must also declare which field using sampleDiversityField
    • maxDocsPerDiversityValue

      public int maxDocsPerDiversityValue()
    • useSignificance

      public void useSignificance(boolean value)
      Controls the choice of algorithm used to select interesting terms. The default value is true which means terms are selected based on significance (see the SignificantTerms aggregation) rather than popularity (using the TermsAggregator).
      Parameters:
      value - true if the significant_terms algorithm should be used.
    • useSignificance

      public boolean useSignificance()
    • returnDetailedInfo

      public void returnDetailedInfo(boolean value)
      Return detailed information about vertex frequencies as part of JSON results - defaults to false
      Parameters:
      value - true if detailed information is required in JSON responses
    • returnDetailedInfo

      public boolean returnDetailedInfo()
    • createNextHop

      public Hop createNextHop(QueryBuilder guidingQuery)
      Add a stage in the graph exploration. Each hop represents a stage of querying elasticsearch to identify terms which can then be connnected to other terms in a subsequent hop.
      Parameters:
      guidingQuery - optional choice of query which influences which documents are considered in this stage
      Returns:
      a Hop object that holds settings for a stage in the graph exploration
    • getHopNumbers

      public int getHopNumbers()
    • getHop

      public Hop getHop(int hopNumber)
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException