terms-enum.asciidoc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. [[search-terms-enum]]
  2. === Terms enum API
  3. ++++
  4. <titleabbrev>Terms enum</titleabbrev>
  5. ++++
  6. The terms enum API can be used to discover terms in the index that match
  7. a partial string. This is used for auto-complete:
  8. [source,console]
  9. --------------------------------------------------
  10. POST stackoverflow/_terms_enum
  11. {
  12. "field" : "tags",
  13. "string" : "kiba"
  14. }
  15. --------------------------------------------------
  16. // TEST[setup:stackoverflow]
  17. The API returns the following response:
  18. [source,console-result]
  19. --------------------------------------------------
  20. {
  21. "_shards": {
  22. "total": 1,
  23. "successful": 1,
  24. "failed": 0
  25. },
  26. "terms": [
  27. "kibana"
  28. ],
  29. "complete" : true
  30. }
  31. --------------------------------------------------
  32. The "complete" flag is false if time or space constraints were met and the
  33. set of terms examined was not the full set of available values.
  34. [[search-terms-enum-api-request]]
  35. ==== {api-request-title}
  36. `GET /<target>/_terms_enum`
  37. [[search-terms-enum-api-desc]]
  38. ==== {api-description-title}
  39. The termsenum API can be used to discover terms in the index that begin with the provided
  40. string. It is designed for low-latency look-ups used in auto-complete scenarios.
  41. [[search-terms-enum-api-path-params]]
  42. ==== {api-path-parms-title}
  43. `<target>`::
  44. (Mandatory, string)
  45. Comma-separated list of data streams, indices, and index aliases to search.
  46. Wildcard (`*`) expressions are supported.
  47. +
  48. To search all data streams or indices in a cluster, omit this parameter or use
  49. `_all` or `*`.
  50. [[search-terms-enum-api-request-body]]
  51. ==== {api-request-body-title}
  52. [[terms-enum-field-param]]
  53. `field`::
  54. (Mandatory, string)
  55. Which field to match
  56. [[terms-enum-string-param]]
  57. `string`::
  58. (Mandatory, string)
  59. The string to match at the start of indexed terms
  60. [[terms-enum-size-param]]
  61. `size`::
  62. (Optional, integer)
  63. How many matching terms to return. Defaults to 10
  64. [[terms-enum-timeout-param]]
  65. `timeout`::
  66. (Optional, <<time-units,time value>>)
  67. The maximum length of time to spend collecting results. Defaults to "1s" (one second).
  68. If the timeout is exceeded the `complete` flag set to false in the response and the results may
  69. be partial or empty.
  70. [[terms-enum-case_insensitive-param]]
  71. `case_insensitive`::
  72. (Optional, boolean)
  73. When true the provided search string is matched against index terms without case sensitivity.
  74. Defaults to false.
  75. [[terms-enum-index_filter-param]]
  76. `index_filter`::
  77. (Optional, <<query-dsl,query object>> Allows to filter an index shard if the provided
  78. query rewrites to `match_none`.
  79. [[terms-enum-search_after-param]]
  80. `string`::
  81. (Optional, string)
  82. The string after which terms in the index should be returned. Allows for a form of
  83. pagination if the last result from one request is passed as the search_after
  84. parameter for a subsequent request.