fielddata.asciidoc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. [[cat-fielddata]]
  2. === cat fielddata API
  3. ++++
  4. <titleabbrev>cat fielddata</titleabbrev>
  5. ++++
  6. .New API reference
  7. [sidebar]
  8. --
  9. For the most up-to-date API details, refer to {api-es}/group/endpoint-cat[Compact and aligned text (CAT) APIs]..
  10. --
  11. [IMPORTANT]
  12. ====
  13. cat APIs are only intended for human consumption using the command line or {kib}
  14. console. They are _not_ intended for use by applications. For application
  15. consumption, use the <<cluster-nodes-stats,nodes stats API>>.
  16. ====
  17. Returns the amount of heap memory currently used by the
  18. <<modules-fielddata, field data cache>> on every data node in the cluster.
  19. [[cat-fielddata-api-request]]
  20. ==== {api-request-title}
  21. `GET /_cat/fielddata/<field>`
  22. `GET /_cat/fielddata`
  23. [[cat-fielddata-api-prereqs]]
  24. ==== {api-prereq-title}
  25. * If the {es} {security-features} are enabled, you must have the `monitor` or
  26. `manage` <<privileges-list-cluster,cluster privilege>> to use this API.
  27. [[cat-fielddata-api-path-params]]
  28. ==== {api-path-parms-title}
  29. `<field>`::
  30. (Optional, string) Comma-separated list of fields used to limit returned
  31. information.
  32. [[cat-fielddata-api-query-params]]
  33. ==== {api-query-parms-title}
  34. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=bytes]
  35. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=http-format]
  36. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
  37. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=help]
  38. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
  39. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
  40. [[cat-fielddata-api-example]]
  41. ==== {api-examples-title}
  42. ////
  43. Hidden setup snippet to build an index with fielddata so our results are real:
  44. [source,console,id=cat-fielddata-example]
  45. --------------------------------------------------
  46. PUT test
  47. {
  48. "mappings": {
  49. "properties": {
  50. "body": {
  51. "type": "text",
  52. "fielddata":true
  53. },
  54. "soul": {
  55. "type": "text",
  56. "fielddata":true
  57. },
  58. "mind": {
  59. "type": "text",
  60. "fielddata":true
  61. }
  62. }
  63. }
  64. }
  65. POST test/_doc?refresh
  66. {
  67. "body": "some words so there is a little field data",
  68. "soul": "some more words",
  69. "mind": "even more words"
  70. }
  71. # Perform a search to load the field data
  72. POST test/_search?sort=body,soul,mind
  73. --------------------------------------------------
  74. ////
  75. [[cat-fielddata-api-example-ind]]
  76. ===== Example with an individual field
  77. You can specify an individual field in the request body or URL path. The
  78. following `fieldata` API request retrieves heap memory size information for the
  79. `body` field.
  80. [source,console]
  81. --------------------------------------------------
  82. GET /_cat/fielddata?v=true&fields=body
  83. --------------------------------------------------
  84. // TEST[continued]
  85. The API returns the following response:
  86. [source,txt]
  87. --------------------------------------------------
  88. id host ip node field size
  89. Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in body 544b
  90. --------------------------------------------------
  91. // TESTRESPONSE[s/544b|480b/\\d+(\\.\\d+)?[tgmk]?b/]
  92. // TESTRESPONSE[s/Nqk-6in[^ ]*/.+/ non_json]
  93. [[cat-fielddata-api-example-list]]
  94. ===== Example with a list of fields
  95. You can specify a comma-separated list of fields in the request body or URL
  96. path. The following `fieldata` API request retrieves heap memory size
  97. information for the `body` and `soul` fields.
  98. [source,console]
  99. --------------------------------------------------
  100. GET /_cat/fielddata/body,soul?v=true
  101. --------------------------------------------------
  102. // TEST[continued]
  103. The API returns the following response:
  104. [source,txt]
  105. --------------------------------------------------
  106. id host ip node field size
  107. Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in body 544b
  108. Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in soul 480b
  109. --------------------------------------------------
  110. // TESTRESPONSE[s/544b|480b/\\d+(\\.\\d+)?[tgmk]?b/]
  111. // TESTRESPONSE[s/Nqk-6in[^ ]*/.+/ s/soul|body/\\w+/ non_json]
  112. The response shows the individual fielddata for the `body` and `soul` fields,
  113. one row per field per node.
  114. [[cat-fielddata-api-example-all]]
  115. ===== Example with all fields in a cluster
  116. The following `fieldata` API request retrieves heap memory size
  117. information all fields.
  118. [source,console]
  119. --------------------------------------------------
  120. GET /_cat/fielddata?v=true
  121. --------------------------------------------------
  122. // TEST[continued]
  123. The API returns the following response:
  124. [source,txt]
  125. --------------------------------------------------
  126. id host ip node field size
  127. Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in body 544b
  128. Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in mind 360b
  129. Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in soul 480b
  130. --------------------------------------------------
  131. // TESTRESPONSE[s/544b|480b|360b/\\d+(\\.\\d+)?[tgmk]?b/]
  132. // TESTRESPONSE[s/Nqk-6in[^ ]*/.+/ s/soul|body|mind/\\w+/ non_json]