Get terms in an index Added in 7.14.0
Discover terms that match a partial string in an index. This "terms enum" API is designed for low-latency look-ups used in auto-complete scenarios.
If the complete
property in the response is false, the returned terms set may be incomplete and should be treated as approximate.
This can occur due to a few reasons, such as a request timeout or a node error.
NOTE: The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents.
Path parameters
-
Comma-separated list of data streams, indices, and index aliases to search. Wildcard (*) expressions are supported.
Body
-
Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.
-
size number
How many matching terms to return.
-
timeout string
A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
case_insensitive boolean
When true the provided search string is matched against index terms without case sensitivity.
-
index_filter object
Additional properties are allowed.
-
string string
The string after which terms in the index should be returned. Allows for a form of pagination if the last result from one request is passed as the search_after parameter for a subsequent request.
-
search_after string
curl \
-X GET http://api.example.com/{index}/_terms_enum \
-H "Content-Type: application/json" \
-d '{"field":"string","size":42.0,"timeout":"string","case_insensitive":true,"index_filter":{},"string":"string","search_after":"string"}'
{
"field": "string",
"size": 42.0,
"timeout": "string",
"case_insensitive": true,
"index_filter": {},
"string": "string",
"search_after": "string"
}
{
"_shards": {
"failed": 42.0,
"successful": 42.0,
"total": 42.0,
"failures": [
{
"index": "string",
"node": "string",
"reason": {
"type": "string",
"reason": "string",
"stack_trace": "string",
"caused_by": {},
"root_cause": [
{}
],
"suppressed": [
{}
]
},
"shard": 42.0,
"status": "string"
}
],
"skipped": 42.0
},
"terms": [
"string"
],
"complete": true
}