Module org.elasticsearch.xcore
Class GraphExploreRequest
java.lang.Object
org.elasticsearch.transport.TransportMessage
org.elasticsearch.transport.TransportRequest
org.elasticsearch.action.ActionRequest
org.elasticsearch.action.LegacyActionRequest
org.elasticsearch.protocol.xpack.graph.GraphExploreRequest
- All Implemented Interfaces:
IndicesRequest,IndicesRequest.Replaceable,Writeable,org.elasticsearch.core.RefCounted,TaskAwareRequest,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.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.RemoteClusterShardRequest, IndicesRequest.Replaceable, IndicesRequest.SingleIndexNoWildcardsNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsFields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCEDFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionGraphExploreRequest(String... indices) Constructs a new graph request to run against the provided indices. -
Method Summary
Modifier and TypeMethodDescriptionbooleancreateNextHop(QueryBuilder guidingQuery) Add a stage in the graph exploration.getHop(int hopNumber) intbooleanString[]indices()indicesOptions(IndicesOptions indicesOptions) intvoidmaxDocsPerDiversityValue(int maxDocs) Optional number of permitted docs with same value in sampled search results.booleanvoidreturnDetailedInfo(boolean value) Return detailed information about vertex frequencies as part of JSON results - defaults to falserouting()voidsampleDiversityField(String name) Optional choice of single-value field on which to diversify sampled search resultsintvoidsampleSize(int maxNumberOfDocsPerHop) The number of top-matching documents that are considered during each hop (default isSamplerAggregationBuilder.DEFAULT_SHARD_SAMPLE_SIZEVery small values (less than 50) may not provide sufficient weight-of-evidence to identify significant connections between terms.org.elasticsearch.core.TimeValuetimeout()timeout(org.elasticsearch.core.TimeValue timeout) Graph exploration can be set to timeout after the given period.toString()org.elasticsearch.xcontent.XContentBuildertoXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) booleanvoiduseSignificance(boolean value) Controls the choice of algorithm used to select interesting terms.validate()voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.action.ActionRequest
getShouldStoreResultMethods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, getRequestId, setParentTask, setRequestIdMethods inherited from class org.elasticsearch.transport.TransportMessage
decRef, hasReferences, incRef, remoteAddress, remoteAddress, tryIncRefMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.core.RefCounted
mustIncRefMethods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
createTask, getDescription, setParentTaskMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
Field Details
-
NO_HOPS_ERROR_MESSAGE
- See Also:
-
NO_VERTICES_ERROR_MESSAGE
- See Also:
-
-
Constructor Details
-
GraphExploreRequest
public GraphExploreRequest() -
GraphExploreRequest
Constructs a new graph request to run against the provided indices. No indices means it will run against all indices. -
GraphExploreRequest
- Throws:
IOException
-
-
Method Details
-
validate
- Specified by:
validatein classActionRequest
-
indices
- Specified by:
indicesin interfaceIndicesRequest
-
allowsRemoteIndices
public boolean allowsRemoteIndices()- Specified by:
allowsRemoteIndicesin interfaceIndicesRequest.Replaceable
-
indices
- Specified by:
indicesin interfaceIndicesRequest.Replaceable
-
indicesOptions
- Specified by:
indicesOptionsin interfaceIndicesRequest
-
includeDataStreams
public boolean includeDataStreams()- Specified by:
includeDataStreamsin interfaceIndicesRequest
-
indicesOptions
-
routing
-
routing
-
routing
-
timeout
public org.elasticsearch.core.TimeValue timeout() -
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- aTimeValueobject which determines the maximum length of time to spend exploring
-
writeTo
- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classActionRequest- Throws:
IOException
-
toString
- Overrides:
toStringin classTransportRequest
-
sampleSize
public void sampleSize(int maxNumberOfDocsPerHop) The number of top-matching documents that are considered during each hop (default isSamplerAggregationBuilder.DEFAULT_SHARD_SAMPLE_SIZEVery 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
Optional choice of single-value field on which to diversify sampled search results -
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 theSignificantTermsaggregation) rather than popularity (using theTermsAggregator).- 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
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
Hopobject that holds settings for a stage in the graph exploration
-
getHopNumbers
public int getHopNumbers() -
getHop
-
toXContent
public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.elasticsearch.xcontent.ToXContent- Throws:
IOException
-