Package org.elasticsearch.client.graph
Class GraphExploreRequest
java.lang.Object
org.elasticsearch.client.graph.GraphExploreRequest
- All Implemented Interfaces:
org.elasticsearch.action.IndicesRequest
,org.elasticsearch.action.IndicesRequest.Replaceable
,Validatable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentObject
public class GraphExploreRequest extends java.lang.Object implements org.elasticsearch.action.IndicesRequest.Replaceable, org.elasticsearch.common.xcontent.ToXContentObject, Validatable
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 class
GraphExploreRequest.TermBoost
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NO_HOPS_ERROR_MESSAGE
static java.lang.String
NO_VERTICES_ERROR_MESSAGE
-
Constructor Summary
Constructors Constructor Description GraphExploreRequest()
GraphExploreRequest(java.lang.String... indices)
Constructs a new graph request to run against the provided indices. -
Method Summary
Modifier and Type Method Description Hop
createNextHop(org.elasticsearch.index.query.QueryBuilder guidingQuery)
Add a stage in the graph exploration.Hop
getHop(int hopNumber)
int
getHopNumbers()
java.lang.String[]
indices()
GraphExploreRequest
indices(java.lang.String... indices)
org.elasticsearch.action.support.IndicesOptions
indicesOptions()
GraphExploreRequest
indicesOptions(org.elasticsearch.action.support.IndicesOptions indicesOptions)
int
maxDocsPerDiversityValue()
void
maxDocsPerDiversityValue(int maxDocs)
Optional number of permitted docs with same value in sampled search results.boolean
returnDetailedInfo()
void
returnDetailedInfo(boolean value)
Return detailed information about vertex frequencies as part of JSON results - defaults to falsejava.lang.String
routing()
GraphExploreRequest
routing(java.lang.String routing)
GraphExploreRequest
routing(java.lang.String... routings)
java.lang.String
sampleDiversityField()
void
sampleDiversityField(java.lang.String name)
Optional choice of single-value field on which to diversify sampled search resultsint
sampleSize()
void
sampleSize(int maxNumberOfDocsPerHop)
The number of top-matching documents that are considered during each hop (default isSamplerAggregationBuilder.DEFAULT_SHARD_SAMPLE_SIZE
Very small values (less than 50) may not provide sufficient weight-of-evidence to identify significant connections between terms.org.elasticsearch.common.unit.TimeValue
timeout()
GraphExploreRequest
timeout(java.lang.String timeout)
GraphExploreRequest
timeout(org.elasticsearch.common.unit.TimeValue timeout)
Graph exploration can be set to timeout after the given period.java.lang.String
toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
java.lang.String[]
types()
Deprecated.Types are in the process of being removed.GraphExploreRequest
types(java.lang.String... types)
Deprecated.Types are in the process of being removed.boolean
useSignificance()
void
useSignificance(boolean value)
Controls the choice of algorithm used to select interesting terms.java.util.Optional<ValidationException>
validate()
Perform validation.
-
Field Details
-
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
-
-
Constructor Details
-
GraphExploreRequest
public GraphExploreRequest() -
GraphExploreRequest
public GraphExploreRequest(java.lang.String... indices)Constructs a new graph request to run against the provided indices. No indices means it will run against all indices.
-
-
Method Details
-
validate
Description copied from interface:Validatable
Perform validation. This method does not have to be overridden in the event that no validation needs to be done, or the validation was done during object construction time. AValidationException
that is not null is assumed to contain validation errors and will be thrown.- Specified by:
validate
in interfaceValidatable
- Returns:
- An
Optional
ValidationException
that contains a list of validation errors.
-
indices
public java.lang.String[] indices()- Specified by:
indices
in interfaceorg.elasticsearch.action.IndicesRequest
-
indices
- Specified by:
indices
in interfaceorg.elasticsearch.action.IndicesRequest.Replaceable
-
indicesOptions
public org.elasticsearch.action.support.IndicesOptions indicesOptions()- Specified by:
indicesOptions
in interfaceorg.elasticsearch.action.IndicesRequest
-
indicesOptions
public GraphExploreRequest indicesOptions(org.elasticsearch.action.support.IndicesOptions indicesOptions) -
types
@Deprecated public java.lang.String[] types()Deprecated.Types are in the process of being removed. Instead of using a type, prefer to filter on a field on the document.The document types to execute the explore against. Defaults to be executed against all types. -
types
Deprecated.Types are in the process of being removed. Instead of using a type, prefer to filter on a field on the document.The document types to execute the explore request against. Defaults to be executed against all types. -
routing
public java.lang.String routing() -
routing
-
routing
-
timeout
public org.elasticsearch.common.unit.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
- aTimeValue
object which determines the maximum length of time to spend exploring
-
timeout
-
toString
public java.lang.String toString()- Overrides:
toString
in 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_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(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 theSignificantTerms
aggregation) 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
Hop
object that holds settings for a stage in the graph exploration
-
getHopNumbers
public int getHopNumbers() -
getHop
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
java.io.IOException
-