fielddata.asciidoc 4.3 KB

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