Get terms in an index

  • POST also GET /{index}/_terms_enum
Auth

Discover terms that match a partial string in an index. This API is designed for low-latency look-ups used in auto-complete scenarios.

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

index string required

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 body

field string required

The string to match at the start of indexed terms. If not provided, all terms in the field are considered.

size number · default: 10

The number of matching terms to return.

timeout string · default: 1s

The maximum length of time to spend collecting results. If the timeout is exceeded the complete flag set to false in the response and the results may be partial or empty.

case_insensitive boolean · default: false

When true, the provided search string is matched against index terms without case sensitivity.

index_filter {} Query

Filter an index shard if the provided query rewrites to match_none.

string string

The string to match at the start of indexed terms. If it is not provided, all terms in the field are considered.

Note

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.

Response

application/json
_shards object required
failed number required

The number of shards the operation or search attempted to run on but failed.

successful number required

The number of shards the operation or search succeeded on.

total number required

The number of shards the operation or search will run on overall.

failures object[]
index string
node string
reason object required
type string required

The type of error

reason union string nullable

A human-readable explanation of the error, in English.

One of: string
stack_trace string

The server stack trace. Present only if the error_trace=true parameter was sent with the request.

caused_by object
Same fields as reason in failures
root_cause object[]
Same fields as reason in failures
suppressed object[]
Same fields as reason in failures
shard number
status string
primary boolean
skipped number
terms string[] required
complete boolean required

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.