- Elasticsearch Guide: other versions:
- Getting Started
- Set up Elasticsearch
- Installing Elasticsearch
- Configuring Elasticsearch
- Important Elasticsearch configuration
- Important System Configuration
- Bootstrap Checks
- Heap size check
- File descriptor check
- Memory lock check
- Maximum number of threads check
- Max file size check
- Maximum size virtual memory check
- Maximum map count check
- Client JVM check
- Use serial collector check
- System call filter check
- OnError and OnOutOfMemoryError checks
- Early-access check
- G1GC check
- All permission check
- Starting Elasticsearch
- Stopping Elasticsearch
- Adding nodes to your cluster
- Installing X-Pack
- Set up X-Pack
- Configuring X-Pack Java Clients
- X-Pack Settings
- Bootstrap Checks for X-Pack
- Upgrade Elasticsearch
- API Conventions
- Document APIs
- Search APIs
- Aggregations
- Metrics Aggregations
- Avg Aggregation
- Cardinality Aggregation
- Extended Stats Aggregation
- Geo Bounds Aggregation
- Geo Centroid Aggregation
- Max Aggregation
- Min Aggregation
- Percentiles Aggregation
- Percentile Ranks Aggregation
- Scripted Metric Aggregation
- Stats Aggregation
- Sum Aggregation
- Top Hits Aggregation
- Value Count Aggregation
- Bucket Aggregations
- Adjacency Matrix Aggregation
- Children Aggregation
- Composite Aggregation
- Date Histogram Aggregation
- Date Range Aggregation
- Diversified Sampler Aggregation
- Filter Aggregation
- Filters Aggregation
- Geo Distance Aggregation
- GeoHash grid Aggregation
- Global Aggregation
- Histogram Aggregation
- IP Range Aggregation
- Missing Aggregation
- Nested Aggregation
- Range Aggregation
- Reverse nested Aggregation
- Sampler Aggregation
- Significant Terms Aggregation
- Significant Text Aggregation
- Terms Aggregation
- Pipeline Aggregations
- Avg Bucket Aggregation
- Derivative Aggregation
- Max Bucket Aggregation
- Min Bucket Aggregation
- Sum Bucket Aggregation
- Stats Bucket Aggregation
- Extended Stats Bucket Aggregation
- Percentiles Bucket Aggregation
- Moving Average Aggregation
- Cumulative Sum Aggregation
- Bucket Script Aggregation
- Bucket Selector Aggregation
- Bucket Sort Aggregation
- Serial Differencing Aggregation
- Matrix Aggregations
- Caching heavy aggregations
- Returning only aggregation results
- Aggregation Metadata
- Returning the type of the aggregation
- Metrics Aggregations
- Indices APIs
- Create Index
- Delete Index
- Get Index
- Indices Exists
- Open / Close Index API
- Shrink Index
- Split Index
- Rollover Index
- Put Mapping
- Get Mapping
- Get Field Mapping
- Types Exists
- Index Aliases
- Update Indices Settings
- Get Settings
- Analyze
- Index Templates
- Indices Stats
- Indices Segments
- Indices Recovery
- Indices Shard Stores
- Clear Cache
- Flush
- Refresh
- Force Merge
- cat APIs
- Cluster APIs
- Query DSL
- Mapping
- Analysis
- Anatomy of an analyzer
- Testing analyzers
- Analyzers
- Normalizers
- Tokenizers
- Standard Tokenizer
- Letter Tokenizer
- Lowercase Tokenizer
- Whitespace Tokenizer
- UAX URL Email Tokenizer
- Classic Tokenizer
- Thai Tokenizer
- NGram Tokenizer
- Edge NGram Tokenizer
- Keyword Tokenizer
- Pattern Tokenizer
- Simple Pattern Tokenizer
- Simple Pattern Split Tokenizer
- Path Hierarchy Tokenizer
- Path Hierarchy Tokenizer Examples
- Token Filters
- Standard Token Filter
- ASCII Folding Token Filter
- Flatten Graph Token Filter
- Length Token Filter
- Lowercase Token Filter
- Uppercase Token Filter
- NGram Token Filter
- Edge NGram Token Filter
- Porter Stem Token Filter
- Shingle Token Filter
- Stop Token Filter
- Word Delimiter Token Filter
- Word Delimiter Graph Token Filter
- Stemmer Token Filter
- Stemmer Override Token Filter
- Keyword Marker Token Filter
- Keyword Repeat Token Filter
- KStem Token Filter
- Snowball Token Filter
- Phonetic Token Filter
- Synonym Token Filter
- Synonym Graph Token Filter
- Compound Word Token Filters
- Reverse Token Filter
- Elision Token Filter
- Truncate Token Filter
- Unique Token Filter
- Pattern Capture Token Filter
- Pattern Replace Token Filter
- Trim Token Filter
- Limit Token Count Token Filter
- Hunspell Token Filter
- Common Grams Token Filter
- Normalization Token Filter
- CJK Width Token Filter
- CJK Bigram Token Filter
- Delimited Payload Token Filter
- Keep Words Token Filter
- Keep Types Token Filter
- Classic Token Filter
- Apostrophe Token Filter
- Decimal Digit Token Filter
- Fingerprint Token Filter
- Minhash Token Filter
- Character Filters
- Modules
- Index Modules
- Ingest Node
- Pipeline Definition
- Ingest APIs
- Accessing Data in Pipelines
- Handling Failures in Pipelines
- Processors
- Append Processor
- Convert Processor
- Date Processor
- Date Index Name Processor
- Fail Processor
- Foreach Processor
- Grok Processor
- Gsub Processor
- Join Processor
- JSON Processor
- KV Processor
- Lowercase Processor
- Remove Processor
- Rename Processor
- Script Processor
- Set Processor
- Split Processor
- Sort Processor
- Trim Processor
- Uppercase Processor
- Dot Expander Processor
- URL Decode Processor
- SQL Access
- Monitor a cluster
- Rolling up historical data
- Secure a cluster
- Overview
- Configuring security
- Encrypting communications in Elasticsearch
- Encrypting communications in an Elasticsearch Docker container
- Enabling cipher suites for stronger encryption
- Separating node-to-node and client traffic
- Configuring an Active Directory realm
- Configuring a file realm
- Configuring an LDAP realm
- Configuring a native realm
- Configuring a PKI realm
- Configuring a SAML realm
- Security settings
- Auditing settings
- Getting started with security
- How security works
- User authentication
- Configuring SAML single-sign-on on the Elastic Stack
- User authorization
- Auditing security events
- Encrypting communications
- Restricting connections with IP filtering
- Cross cluster search, tribe, clients, and integrations
- Reference
- Troubleshooting
- Can’t log in after upgrading to 6.3.2
- Some settings are not returned via the nodes settings API
- Authorization exceptions
- Users command fails due to extra arguments
- Users are frequently locked out of Active Directory
- Certificate verification fails for curl on Mac
- SSLHandshakeException causes connections to fail
- Common SSL/TLS exceptions
- Common SAML issues
- Internal Server Error in Kibana
- Setup-passwords command fails due to connection failure
- Failures due to relocation of the configuration files
- Limitations
- Alerting on Cluster and Index Events
- X-Pack APIs
- Info API
- Explore API
- Licensing APIs
- Migration APIs
- Machine Learning APIs
- Add Events to Calendar
- Add Jobs to Calendar
- Close Jobs
- Create Calendar
- Create Datafeeds
- Create Jobs
- Delete Calendar
- Delete Datafeeds
- Delete Events from Calendar
- Delete Jobs
- Delete Jobs from Calendar
- Delete Model Snapshots
- Flush Jobs
- Forecast Jobs
- Get Calendars
- Get Buckets
- Get Overall Buckets
- Get Categories
- Get Datafeeds
- Get Datafeed Statistics
- Get Influencers
- Get Jobs
- Get Job Statistics
- Get Model Snapshots
- Get Scheduled Events
- Get Records
- Open Jobs
- Post Data to Jobs
- Preview Datafeeds
- Revert Model Snapshots
- Start Datafeeds
- Stop Datafeeds
- Update Datafeeds
- Update Jobs
- Update Model Snapshots
- Rollup APIs
- Security APIs
- Authenticate API
- Change passwords API
- Clear Cache API
- Create or update role mappings API
- Clear roles cache API
- Create or update roles API
- Create or update users API
- Delete role mappings API
- Delete roles API
- Delete users API
- Disable users API
- Enable users API
- Get role mappings API
- Get roles API
- Get token API
- Get users API
- Privilege APIs
- Invalidate token API
- SSL Certificate API
- Watcher APIs
- Definitions
- Command line tools
- How To
- Testing
- Glossary of terms
- Release Highlights
- Breaking changes
- Release Notes
- Elasticsearch version 6.3.2
- Elasticsearch version 6.3.1
- Elasticsearch version 6.3.0
- Elasticsearch version 6.2.4
- Elasticsearch version 6.2.3
- Elasticsearch version 6.2.2
- Elasticsearch version 6.2.1
- Elasticsearch version 6.2.0
- Elasticsearch version 6.1.4
- Elasticsearch version 6.1.3
- Elasticsearch version 6.1.2
- Elasticsearch version 6.1.1
- Elasticsearch version 6.1.0
- Elasticsearch version 6.0.1
- Elasticsearch version 6.0.0
- Elasticsearch version 6.0.0-rc2
- Elasticsearch version 6.0.0-rc1
- Elasticsearch version 6.0.0-beta2
- Elasticsearch version 6.0.0-beta1
- Elasticsearch version 6.0.0-alpha2
- Elasticsearch version 6.0.0-alpha1
- Elasticsearch version 6.0.0-alpha1 (Changes previously released in 5.x)
Explore API
editExplore API
editThe Graph explore API enables you to extract and summarize information about the documents and terms in your Elasticsearch index.
The easiest way to understand the behaviour of this API is to use the
Graph UI to explore connections. You can view the most recent request submitted
to the _explore
endpoint from the Last request panel. For more information,
see Getting Started with Graph.
For additional information about working with the explore API, see the Graph Troubleshooting and Limitations topics.
Request
editPOST <index>/_xpack/graph/_explore
Description
editAn 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 _explore
requests
enable you to spider out from one more vertices of interest. You can exclude
vertices that have already been returned.
Request Body
edit- query
-
A seed query that identifies the documents of interest. Can be any valid Elasticsearch query. For example:
"query": { "bool": { "must": { "match": { "query.raw": "midi" } }, "filter": [ { "range": { "query_time": { "gte": "2015-10-01 00:00:00" } } } ] } }
- vertices
-
Specifies or more fields that contain the terms you want to include in the graph as vertices. For example:
"vertices": [ { "field": "product" } ]
- field
- Identifies a field in the documents of interest.
- include
-
Identifies the terms of interest that form the starting points
from which you want to spider out. You do not have to specify a seed query
if you specify an include clause. The include clause implicitly querys for
documents that contain any of the listed terms listed.
In addition to specifying a simple array of strings, you can also pass
objects with
term
andboost
values to boost matches on particular terms. - exclude
-
The
exclude
clause prevents the specified terms from being included in the results. - size
- Specifies the maximum number of vertex terms returned for each field. Defaults to 5.
- min_doc_count
- 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. Defaults to 3.
- shard_min_doc_count
- This advanced setting controls how many documents on a particular shard have to contain a pair of terms before the connection is returned for global consideration. Defaults to 2.
- connections
-
Specifies or more fields from which you want to extract terms that are associated with the specified vertices. For example:
Connections can be nested inside the
connections
object to explore additional relationships in the data. Each level of nesting is considered a hop, and proximity within the graph is often described in terms of hop depth.- query
- An optional guiding query that constrains the Graph API as it explores connected terms. For example, you might want to direct the Graph API to ignore older data by specifying a query that identifies recent documents.
- vertices
-
Contains the fields you are interested in. For example:
"vertices": [ { "field": "query.raw", "size": 5, "min_doc_count": 10, "shard_min_doc_count": 3 } ]
- controls
-
Direct the Graph API how to build the graph.
- use_significance
-
The
use_significance
flag filters associated terms so only those that are significantly associated with your query are included. For information about the algorithm used to calculate significance, see the significant_terms aggregation. Defaults totrue
. - sample_size
- 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. Defaults to 100 documents.
- timeout
- 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.
- sample_diversity
-
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. For example:
"sample_diversity": { "field": "category.raw", "max_docs_per_value": 500 }
Examples
editBasic exploration
editAn initial search typically begins with a query to identify strongly related terms.
POST clicklogs/_xpack/graph/_explore { "query": { "match": { "query.raw": "midi" } }, "vertices": [ { "field": "product" } ], "connections": { "vertices": [ { "field": "query.raw" } ] } }
Seed the exploration with a query. This example is searching clicklogs for people who searched for the term "midi". |
|
Identify the vertices to include in the graph. This example is looking for product codes that are significantly associated with searches for "midi". |
|
Find the connections. This example is looking for other search terms that led people to click on the products that are associated with searches for "midi". |
The response from the explore API looks like this:
{ "took": 0, "timed_out": false, "failures": [], "vertices": [ { "field": "query.raw", "term": "midi cable", "weight": 0.08745858139552132, "depth": 1 }, { "field": "product", "term": "8567446", "weight": 0.13247784285434397, "depth": 0 }, { "field": "product", "term": "1112375", "weight": 0.018600718471158982, "depth": 0 }, { "field": "query.raw", "term": "midi keyboard", "weight": 0.04802242866755111, "depth": 1 } ], "connections": [ { "source": 0, "target": 1, "weight": 0.04802242866755111, "doc_count": 13 }, { "source": 2, "target": 3, "weight": 0.08120623870976627, "doc_count": 23 } ] }
An array of all of the vertices that were discovered. A vertex is an indexed
term, so the field and term value are provided. The |
|
The connections between the vertices in the array. The |
Optional controls
editThe default settings are configured to remove noisy data and get the "big picture" from your data. This example shows how to specify additional parameters to influence how the graph is built.
For tips on tuning the settings for more detailed forensic evaluation where every document could be of interest, see the Troubleshooting guide.
POST clicklogs/_xpack/graph/_explore { "query": { "match": { "query.raw": "midi" } }, "controls": { "use_significance": false, "sample_size": 2000, "timeout": 2000, "sample_diversity": { "field": "category.raw", "max_docs_per_value": 500 } }, "vertices": [ { "field": "product", "size": 5, "min_doc_count": 10, "shard_min_doc_count": 3 } ], "connections": { "query": { "bool": { "filter": [ { "range": { "query_time": { "gte": "2015-10-01 00:00:00" } } } ] } }, "vertices": [ { "field": "query.raw", "size": 5, "min_doc_count": 10, "shard_min_doc_count": 3 } ] } }
Disable |
|
Increase the sample size to consider a larger set of documents on each shard. |
|
Limit how long a graph request runs before returning results. |
|
Ensure diversity in the sample by setting a limit on the number of documents per value in a particular single-value field, such as a category field. |
|
Control the maximum number of vertex terms returned for each field. |
|
Set a certainty threshold that specifies how many documents have to contain a pair of terms before we consider it to be a useful connection. |
|
Specify how many documents on a shard have to contain a pair of terms before the connection is returned for global consideration. |
|
Restrict which document are considered as you explore connected terms. |
Spidering operations
editAfter an initial search, you typically want to select vertices of interest and see what additional vertices are connected. In graph-speak, this operation is referred to as "spidering". By submitting a series of requests, you can progressively build a graph of related information.
To spider out, you need to specify two things:
- The set of vertices for which you want to find additional connections
- The set of vertices you already know about that you want to exclude from the results of the spidering operation.
You specify this information using include`and `exclude
clauses. For example,
the following request starts with the product 1854873
and spiders
out to find additional search terms associated with that product. The terms
"midi", "midi keyboard", and "synth" are excluded from the results.
On this page