123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- [[search-terms-enum]]
- === Terms enum API
- ++++
- <titleabbrev>Terms enum</titleabbrev>
- ++++
- The terms enum API can be used to discover terms in the index that match
- a partial string. This is used for auto-complete:
- [source,console]
- --------------------------------------------------
- POST stackoverflow/_terms_enum
- {
- "field" : "tags",
- "string" : "kiba"
- }
- --------------------------------------------------
- // TEST[setup:stackoverflow]
- The API returns the following response:
- [source,console-result]
- --------------------------------------------------
- {
- "_shards": {
- "total": 1,
- "successful": 1,
- "failed": 0
- },
- "terms": [
- "kibana"
- ],
- "complete" : true
- }
- --------------------------------------------------
- The "complete" flag is false if time or space constraints were met and the
- set of terms examined was not the full set of available values.
- [[search-terms-enum-api-request]]
- ==== {api-request-title}
- `GET /<target>/_terms_enum`
- [[search-terms-enum-api-desc]]
- ==== {api-description-title}
- The termsenum API can be used to discover terms in the index that begin with the provided
- string. It is designed for low-latency look-ups used in auto-complete scenarios.
- [[search-terms-enum-api-path-params]]
- ==== {api-path-parms-title}
- `<target>`::
- (Mandatory, string)
- Comma-separated list of data streams, indices, and index aliases to search.
- Wildcard (`*`) expressions are supported.
- +
- To search all data streams or indices in a cluster, omit this parameter or use
- `_all` or `*`.
- [[search-terms-enum-api-request-body]]
- ==== {api-request-body-title}
- [[terms-enum-field-param]]
- `field`::
- (Mandatory, string)
- Which field to match
- [[terms-enum-string-param]]
- `string`::
- (Mandatory, string)
- The string to match at the start of indexed terms
- [[terms-enum-size-param]]
- `size`::
- (Optional, integer)
- How many matching terms to return. Defaults to 10
- [[terms-enum-timeout-param]]
- `timeout`::
- (Optional, <<time-units,time value>>)
- The maximum length of time to spend collecting results. Defaults to "1s" (one second).
- If the timeout is exceeded the `complete` flag set to false in the response and the results may
- be partial or empty.
- [[terms-enum-case_insensitive-param]]
- `case_insensitive`::
- (Optional, boolean)
- When true the provided search string is matched against index terms without case sensitivity.
- Defaults to false.
- [[terms-enum-index_filter-param]]
- `index_filter`::
- (Optional, <<query-dsl,query object>> Allows to filter an index shard if the provided
- query rewrites to `match_none`.
- [[terms-enum-search_after-param]]
- `string`::
- (Optional, string)
- The string after which terms in the index should be returned. Allows for a form of
- pagination if the last result from one request is passed as the search_after
- parameter for a subsequent request.
|