Get terms in an index
Generally available
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.
-
The number of matching terms to return.
-
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. -
When
true
, the provided search string is matched against index terms without case sensitivity. -
An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
External documentation -
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.
-
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.
POST stackoverflow/_terms_enum
{
"field" : "tags",
"string" : "kiba"
}
resp = client.terms_enum(
index="stackoverflow",
field="tags",
string="kiba",
)
const response = await client.termsEnum({
index: "stackoverflow",
field: "tags",
string: "kiba",
});
response = client.terms_enum(
index: "stackoverflow",
body: {
"field": "tags",
"string": "kiba"
}
)
$resp = $client->termsEnum([
"index" => "stackoverflow",
"body" => [
"field" => "tags",
"string" => "kiba",
],
]);
curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"field":"tags","string":"kiba"}' "$ELASTICSEARCH_URL/stackoverflow/_terms_enum"
{
"field" : "tags",
"string" : "kiba"
}
{
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"terms": [
"kibana"
],
"complete" : true
}