fielddata.asciidoc 4.8 KB

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