Explore graph analytics

  • POST also GET /{index}/_graph/explore
Auth

Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. Subsequent requests enable you to spider out from one more vertices of interest. You can exclude vertices that have already been returned.

Learn more about graphs

Path parameters

index union string | string[] required

Name of the index.

Query parameters

routing union string | string[]

Custom value used to route operations to a specific shard.

timeout string

Specifies the period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout.

Request body

connections object

Specifies or more fields from which you want to extract terms that are associated with the specified vertices.

connections object

Specifies one or more fields from which you want to extract terms that are associated with the specified vertices.

Same fields as connections
query {} Query

An optional guiding query that constrains the Graph API as it explores connected terms.

vertices object[] required

Contains the fields you are interested in.

exclude string[]

Prevents the specified terms from being included in the results.

field string required

Identifies a field in the documents of interest.

include object[]

Identifies the terms of interest that form the starting points from which you want to spider out.

boost number
term string required
min_doc_count number · default: 3

Specifies how many documents must contain a pair of terms before it is considered to be a useful connection. This setting acts as a certainty threshold.

shard_min_doc_count number · default: 2

Controls how many documents on a particular shard have to contain a pair of terms before the connection is returned for global consideration.

size number · default: 5

Specifies the maximum number of vertex terms returned for each field.

controls object

Direct the Graph API how to build the graph.

sample_diversity object

To avoid the top-matching documents sample being dominated by a single source of results, it is sometimes necessary to request diversity in the sample. You can do this by selecting a single-value field and setting a maximum number of documents per value for that field.

field string required
max_docs_per_value number required
sample_size number · default: 100

Each hop considers a sample of the best-matching documents on each shard. Using samples improves the speed of execution and keeps exploration focused on meaningfully-connected terms. Very small values (less than 50) might not provide sufficient weight-of-evidence to identify significant connections between terms. Very large sample sizes can dilute the quality of the results and increase execution times.

timeout string

The length of time in milliseconds after which exploration will be halted and the results gathered so far are returned. This timeout is honored on a best-effort basis. Execution might overrun this timeout if, for example, a long pause is encountered while FieldData is loaded for a field.

use_significance boolean required

Filters associated terms so only those that are significantly associated with your query are included.

query {} Query

A seed query that identifies the documents of interest. Can be any valid Elasticsearch query.

vertices object[]

Specifies one or more fields that contain the terms you want to include in the graph as vertices.

exclude string[]

Prevents the specified terms from being included in the results.

field string required

Identifies a field in the documents of interest.

include object[]

Identifies the terms of interest that form the starting points from which you want to spider out.

boost number
term string required
min_doc_count number · default: 3

Specifies how many documents must contain a pair of terms before it is considered to be a useful connection. This setting acts as a certainty threshold.

shard_min_doc_count number · default: 2

Controls how many documents on a particular shard have to contain a pair of terms before the connection is returned for global consideration.

size number · default: 5

Specifies the maximum number of vertex terms returned for each field.

Response

application/json
connections object[] required
doc_count number required
source number required
target number required
weight number required
failures object[] required
index string
node string
reason object required
type string required

The type of error

reason union string nullable

A human-readable explanation of the error, in English.

One of: string
stack_trace string

The server stack trace. Present only if the error_trace=true parameter was sent with the request.

caused_by object
Same fields as reason in failures
root_cause object[]
Same fields as reason in failures
suppressed object[]
Same fields as reason in failures
shard number
status string
primary boolean
timed_out boolean required
took number required
vertices object[] required
depth number required
field string required
term string required
weight number required