term_vector
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is generally available and ready for production usage. Serverless interfaces and procedures might differ from classic Elastic Stack deployments. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless
Generally available
Stack
Generally available
Term vectors contain information about the terms produced by the analysis process, including:
- a list of terms.
- the position (or order) of each term.
- the start and end character offsets mapping the term to its origin in the original string.
- payloads (if they are available) — user-defined binary data associated with each term position.
These term vectors can be stored so that they can be retrieved for a particular document.
Refer to the term vectors API examples page for usage examples.
The term_vector setting accepts:
no- No term vectors are stored. (default)
yes- Just the terms in the field are stored.
with_positions- Terms and positions are stored.
with_offsets- Terms and character offsets are stored.
with_positions_offsets- Terms, positions, and character offsets are stored.
with_positions_payloads- Terms, positions, and payloads are stored.
with_positions_offsets_payloads- Terms, positions, offsets and payloads are stored.
The fast vector highlighter requires with_positions_offsets. The term vectors API can retrieve whatever is stored.
Setting with_positions_offsets will double the size of a field’s index.
PUT my-index-000001{ "mappings": { "properties": { "text": { "type": "text", "term_vector": "with_positions_offsets" } } } }PUT my-index-000001/_doc/1{ "text": "Quick brown fox" }GET my-index-000001/_search{ "query": { "match": { "text": "brown fox" } }, "highlight": { "fields": { "text": {} } } }
- The fast vector highlighter will be used by default for the
textfield because term vectors are enabled.