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