Get terms in an index
- POST also GET /{index}/_terms_enum
Discover terms that match a partial string in an index. This API is designed for low-latency look-ups used in auto-complete scenarios.
info 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
-
indexIndexName | IndexNamerequired -
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.
Request
-
fieldstring Fieldrequired -
The string to match at the start of indexed terms. If not provided, all terms in the field are considered.
-
sizenumber · default: 10 -
The number of matching terms to return.
-
timeoutstring Duration · default: 1s -
The maximum length of time to spend collecting results. If the timeout is exceeded the
completeflag set tofalsein the response and the results may be partial or empty. -
case_insensitiveboolean · default: false -
When
true, the provided search string is matched against index terms without case sensitivity. -
index_filterQueryContainer -
Filter an index shard if the provided query rewrites to
match_none. -
stringstring -
The string to match at the start of indexed terms. If it is not provided, all terms in the field are considered.
info The prefix string cannot be larger than the largest possible keyword value, which is Lucene's term byte-length limit of 32766.
-
search_afterstring -
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_afterparameter for a subsequent request.
Response
-
_shardsShardStatisticsrequired -
failednumber uintrequired -
The number of shards the operation or search attempted to run on but failed.
-
successfulnumber uintrequired -
The number of shards the operation or search succeeded on.
-
totalnumber uintrequired -
The number of shards the operation or search will run on overall.
-
failuresShardFailure -
indexstring IndexName -
nodestring -
reasonErrorCauserequired -
typestringrequired -
The type of error
-
reasonstringnullable -
A human-readable explanation of the error, in English.
-
stack_tracestring -
The server stack trace. Present only if the
error_trace=trueparameter was sent with the request. -
caused_byErrorCause -
root_causeErrorCause -
suppressedErrorCause -
shardnumber -
statusstring -
primaryboolean -
skippednumber uint -
termsstringrequired -
completebooleanrequired -
If
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.