IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
term_vector
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
term_vector
editTerm 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.
These term vectors can be stored so that they can be retrieved for a particular document.
The term_vector setting accepts:
|
|
No term vectors are stored. (default) |
|
|
Just the terms in the field are stored. |
|
|
Terms and positions are stored. |
|
|
Terms and character offsets are stored. |
|
|
Terms, positions, and character offsets 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
{
"mappings": {
"my_type": {
"properties": {
"text": {
"type": "text",
"term_vector": "with_positions_offsets"
}
}
}
}
}
PUT my_index/my_type/1
{
"text": "Quick brown fox"
}
GET my_index/_search
{
"query": {
"match": {
"text": "brown fox"
}
},
"highlight": {
"fields": {
"text": {}
}
}
}