fielddata.asciidoc 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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/<field>`
  11. [[cat-fielddata-api-path-params]]
  12. ==== {api-path-parms-title}
  13. `<field>`::
  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,console]
  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. ////
  61. [[cat-fielddata-api-example-ind]]
  62. ===== Example with an individual field
  63. You can specify an individual field in the request body or URL path. The
  64. following `fieldata` API request retrieves heap memory size information for the
  65. `body` field.
  66. [source,console]
  67. --------------------------------------------------
  68. GET /_cat/fielddata?v&fields=body
  69. --------------------------------------------------
  70. // TEST[continued]
  71. The API returns the following response:
  72. [source,txt]
  73. --------------------------------------------------
  74. id host ip node field size
  75. Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in body 544b
  76. --------------------------------------------------
  77. // TESTRESPONSE[s/544b|480b/\\d+(\\.\\d+)?[tgmk]?b/]
  78. // TESTRESPONSE[s/Nqk-6in[^ ]*/.+/ non_json]
  79. [[cat-fielddata-api-example-list]]
  80. ===== Example with a list of fields
  81. You can specify a comma-separated list of fields in the request body or URL
  82. path. The following `fieldata` API request retrieves heap memory size
  83. information for the `body` and `soul` fields.
  84. [source,console]
  85. --------------------------------------------------
  86. GET /_cat/fielddata/body,soul?v
  87. --------------------------------------------------
  88. // TEST[continued]
  89. The API returns the following response:
  90. [source,txt]
  91. --------------------------------------------------
  92. id host ip node field size
  93. Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in body 544b
  94. Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in soul 480b
  95. --------------------------------------------------
  96. // TESTRESPONSE[s/544b|480b/\\d+(\\.\\d+)?[tgmk]?b/]
  97. // TESTRESPONSE[s/Nqk-6in[^ ]*/.+/ s/soul|body/\\w+/ non_json]
  98. The response shows the individual fielddata for the `body` and `soul` fields,
  99. one row per field per node.
  100. [[cat-fielddata-api-example-all]]
  101. ===== Example with all fields in a cluster
  102. The following `fieldata` API request retrieves heap memory size
  103. information all fields.
  104. [source,console]
  105. --------------------------------------------------
  106. GET /_cat/fielddata?v
  107. --------------------------------------------------
  108. // TEST[continued]
  109. The API returns the following response:
  110. [source,txt]
  111. --------------------------------------------------
  112. id host ip node field size
  113. Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in body 544b
  114. Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in mind 360b
  115. Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in soul 480b
  116. --------------------------------------------------
  117. // TESTRESPONSE[s/544b|480b|360b/\\d+(\\.\\d+)?[tgmk]?b/]
  118. // TESTRESPONSE[s/Nqk-6in[^ ]*/.+/ s/soul|body|mind/\\w+/ non_json]