Get terms in an index Added in 7.14.0
Discover terms that match a partial string in an index. This API is designed for low-latency look-ups used in auto-complete scenarios.
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
-
A comma-separated list of data streams, indices, and index aliases to search. Wildcard (
*
) expressions are supported. To search all data streams or indices, omit this parameter or use*
or_all
.
Body
-
Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.
-
size number
The number of 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
An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
Additional properties are allowed.
-
string string
The string to match at the start of indexed terms. If it is not provided, all terms in the field are considered.
The prefix string cannot be larger than the largest possible keyword value, which is Lucene's term byte-length limit of 32766.
-
search_after string
The string after which terms in the index should be returned. It allows for a form of pagination if the last result from one request is passed as the
search_after
parameter for a subsequent request.
curl \
--request POST http://api.example.com/{index}/_terms_enum \
--header "Content-Type: application/json" \
--data '"{\n \"field\" : \"tags\",\n \"string\" : \"kiba\"\n}"'
{
"field" : "tags",
"string" : "kiba"
}
{
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"terms": [
"kibana"
],
"complete" : true
}