Type to search.

Get terms in an index

  • POST also GET /{index}/_terms_enum
Auth The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Generally available since 7.14 This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

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 union oneOf · 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.

Values: -1 0
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.

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.