fielddata.asciidoc 4.5 KB

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