Class GraphExploreRequest
- java.lang.Object
-
- org.elasticsearch.transport.TransportMessage
-
- org.elasticsearch.transport.TransportRequest
-
- org.elasticsearch.action.ActionRequest
-
- org.elasticsearch.protocol.xpack.graph.GraphExploreRequest
-
- All Implemented Interfaces:
IndicesRequest,IndicesRequest.Replaceable,Streamable,Writeable,ToXContent,ToXContentObject,TaskAwareRequest
public class GraphExploreRequest extends ActionRequest implements IndicesRequest.Replaceable, ToXContentObject
Holds the criteria required to guide the exploration of connected terms which can be returned as a graph.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGraphExploreRequest.TermBoost-
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportRequest
TransportRequest.Empty
-
Nested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.Replaceable
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V extends java.lang.Object>, Writeable.Writer<V extends java.lang.Object>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNO_HOPS_ERROR_MESSAGEstatic java.lang.StringNO_VERTICES_ERROR_MESSAGE-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description GraphExploreRequest()GraphExploreRequest(java.lang.String... indices)Constructs a new graph request to run against the provided indices.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HopcreateNextHop(QueryBuilder guidingQuery)Add a stage in the graph exploration.HopgetHop(int hopNumber)intgetHopNumbers()java.lang.String[]indices()GraphExploreRequestindices(java.lang.String... indices)IndicesOptionsindicesOptions()GraphExploreRequestindicesOptions(IndicesOptions indicesOptions)intmaxDocsPerDiversityValue()voidmaxDocsPerDiversityValue(int maxDocs)Optional number of permitted docs with same value in sampled search results.voidreadFrom(StreamInput in)booleanreturnDetailedInfo()voidreturnDetailedInfo(boolean value)Return detailed information about vertex frequencies as part of JSON results - defaults to falsejava.lang.Stringrouting()GraphExploreRequestrouting(java.lang.String routing)GraphExploreRequestrouting(java.lang.String... routings)java.lang.StringsampleDiversityField()voidsampleDiversityField(java.lang.String name)Optional choice of single-value field on which to diversify sampled search resultsintsampleSize()voidsampleSize(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.TimeValuetimeout()GraphExploreRequesttimeout(java.lang.String timeout)GraphExploreRequesttimeout(TimeValue timeout)Graph exploration can be set to timeout after the given period.java.lang.StringtoString()XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)java.lang.String[]types()GraphExploreRequesttypes(java.lang.String... types)booleanuseSignificance()voiduseSignificance(boolean value)Controls the choice of algorithm used to select interesting terms.ActionRequestValidationExceptionvalidate()voidwriteTo(StreamOutput out)-
Methods inherited from class org.elasticsearch.action.ActionRequest
getShouldStoreResult
-
Methods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTask
-
Methods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
createTask, getDescription, setParentTask
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Field Detail
-
NO_HOPS_ERROR_MESSAGE
public static final java.lang.String NO_HOPS_ERROR_MESSAGE
- See Also:
- Constant Field Values
-
NO_VERTICES_ERROR_MESSAGE
public static final java.lang.String NO_VERTICES_ERROR_MESSAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
validate
public ActionRequestValidationException validate()
- Specified by:
validatein classActionRequest
-
indices
public java.lang.String[] indices()
- Specified by:
indicesin interfaceIndicesRequest
-
indices
public GraphExploreRequest indices(java.lang.String... indices)
- Specified by:
indicesin interfaceIndicesRequest.Replaceable
-
indicesOptions
public IndicesOptions indicesOptions()
- Specified by:
indicesOptionsin interfaceIndicesRequest
-
indicesOptions
public GraphExploreRequest indicesOptions(IndicesOptions indicesOptions)
-
types
public java.lang.String[] types()
-
types
public GraphExploreRequest types(java.lang.String... types)
-
routing
public java.lang.String routing()
-
routing
public GraphExploreRequest routing(java.lang.String routing)
-
routing
public GraphExploreRequest routing(java.lang.String... routings)
-
timeout
public TimeValue timeout()
-
timeout
public GraphExploreRequest timeout(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- aTimeValueobject which determines the maximum length of time to spend exploring
-
timeout
public GraphExploreRequest timeout(java.lang.String timeout)
-
readFrom
public void readFrom(StreamInput in) throws java.io.IOException
- Specified by:
readFromin interfaceStreamable- Overrides:
readFromin classActionRequest- Throws:
java.io.IOException
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
- Specified by:
writeToin interfaceStreamable- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classActionRequest- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
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
public void sampleDiversityField(java.lang.String name)
Optional choice of single-value field on which to diversify sampled search results
-
sampleDiversityField
public java.lang.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 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
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
Hopobject that holds settings for a stage in the graph exploration
-
getHopNumbers
public int getHopNumbers()
-
getHop
public Hop getHop(int hopNumber)
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-
-