[[reference-terms_enum]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////

[discrete]
=== client.termsEnum

Get terms in an index. Discover terms that match a partial string in an index. This "terms enum" API is designed for low-latency look-ups used in auto-complete scenarios. If the `complete` property in the response is 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. 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.

{ref}/search-terms-enum.html[{es} documentation]

[discrete]
==== Function signature

[source,ts]
----
(TermsEnumRequest, options?): Promise<TermsEnumResponse>
----

[discrete]
===== `TermsEnumRequest`

[source,ts]
----
interface TermsEnumRequest extends <<shared-type-request-base, RequestBase>> {
  index: <<shared-type-index-name, IndexName>>
  field: <<shared-type-field, Field>>
  size?: <<shared-type-integer, integer>>
  timeout?: <<shared-type-duration, Duration>>
  case_insensitive?: boolean
  index_filter?: QueryDslQueryContainer
  string?: string
  search_after?: string
}
----

[discrete]
===== `TermsEnumResponse`

[source,ts]
----
interface TermsEnumResponse {
  _shards: <<shared-type-shard-statistics, ShardStatistics>>
  terms: string[]
  complete: boolean
}
----

