diskusage.asciidoc 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. [[indices-disk-usage]]
  2. === Analyze index disk usage API
  3. ++++
  4. <titleabbrev>Analyze index disk usage</titleabbrev>
  5. ++++
  6. experimental[]
  7. Analyzes the disk usage of each field of an index or data stream.
  8. This API might not support indices created in previous {es} versions.
  9. The result of a small index can be inaccurate as some parts of an index
  10. might not be analyzed by the API.
  11. [source,console]
  12. --------------------------------------------------
  13. POST /my-index-000001/_disk_usage?run_expensive_tasks=true
  14. --------------------------------------------------
  15. // TEST[setup:messages]
  16. [[analyze-index-disk-usage-api-request]]
  17. ==== {api-request-title}
  18. `POST /<target>/_disk_usage`
  19. [[analyze-index-disk-usage-api-request-prereqs]]
  20. ==== {api-prereq-title}
  21. * If the {es} {security-features} are enabled, you must have the `manage`
  22. <<privileges-list-indices,index privilege>> for the target index, data stream,
  23. or alias.
  24. [[analyze-index-disk-usage-api-path-params]]
  25. ==== {api-path-parms-title}
  26. `<target>`::
  27. (Required, string) Comma-separated list of data streams, indices, and aliases
  28. used to limit the request. It's recommended to execute this API with a single
  29. index (or the latest backing index of a data stream) as the API consumes
  30. resources significantly.
  31. [[analyze-index-disk-usage-api-query-params]]
  32. ==== {api-query-parms-title}
  33. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
  34. +
  35. Defaults to `true`.
  36. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  37. +
  38. Defaults to `open`.
  39. `flush`::
  40. (Optional, Boolean) If `true`, the API performs a flush before analysis. If
  41. `false`, the response may not include uncommitted data. Defaults to `true`.
  42. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
  43. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  44. `run_expensive_tasks`::
  45. (Required, Boolean) Analyzing field disk usage is resource-intensive. To use the
  46. API, this parameter must be set to `true`. Defaults to `false`.
  47. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=wait_for_active_shards]
  48. [[analyze-index-disk-usage-api-example]]
  49. ==== {api-examples-title}
  50. [source,console]
  51. --------------------------------------------------
  52. POST /my-index-000001/_disk_usage?run_expensive_tasks=true
  53. --------------------------------------------------
  54. // TEST[setup:messages]
  55. The API returns:
  56. [source,console-response]
  57. --------------------------------------------------
  58. {
  59. "_shards": {
  60. "total": 1,
  61. "successful": 1,
  62. "failed": 0
  63. },
  64. "my-index-000001": {
  65. "store_size": "929mb", <1>
  66. "store_size_in_bytes": 974192723,
  67. "all_fields": {
  68. "total": "928.9mb", <2>
  69. "total_in_bytes": 973977084,
  70. "inverted_index": {
  71. "total": "107.8mb",
  72. "total_in_bytes": 113128526
  73. },
  74. "stored_fields": "623.5mb",
  75. "stored_fields_in_bytes": 653819143,
  76. "doc_values": "125.7mb",
  77. "doc_values_in_bytes": 131885142,
  78. "points": "59.9mb",
  79. "points_in_bytes": 62885773,
  80. "norms": "2.3kb",
  81. "norms_in_bytes": 2356,
  82. "term_vectors": "2.2kb",
  83. "term_vectors_in_bytes": 2310
  84. },
  85. "fields": {
  86. "_id": {
  87. "total": "49.3mb",
  88. "total_in_bytes": 51709993,
  89. "inverted_index": {
  90. "total": "29.7mb",
  91. "total_in_bytes": 31172745
  92. },
  93. "stored_fields": "19.5mb", <3>
  94. "stored_fields_in_bytes": 20537248,
  95. "doc_values": "0b",
  96. "doc_values_in_bytes": 0,
  97. "points": "0b",
  98. "points_in_bytes": 0,
  99. "norms": "0b",
  100. "norms_in_bytes": 0,
  101. "term_vectors": "0b",
  102. "term_vectors_in_bytes": 0
  103. },
  104. "_primary_term": {...},
  105. "_seq_no": {...},
  106. "_version": {...},
  107. "_source": {
  108. "total": "603.9mb",
  109. "total_in_bytes": 633281895,
  110. "inverted_index": {...},
  111. "stored_fields": "603.9mb", <4>
  112. "stored_fields_in_bytes": 633281895,
  113. "doc_values": "0b",
  114. "doc_values_in_bytes": 0,
  115. "points": "0b",
  116. "points_in_bytes": 0,
  117. "norms": "0b",
  118. "norms_in_bytes": 0,
  119. "term_vectors": "0b",
  120. "term_vectors_in_bytes": 0
  121. },
  122. "context": {
  123. "total": "28.6mb",
  124. "total_in_bytes": 30060405,
  125. "inverted_index": {
  126. "total": "22mb",
  127. "total_in_bytes": 23090908
  128. },
  129. "stored_fields": "0b",
  130. "stored_fields_in_bytes": 0,
  131. "doc_values": "0b",
  132. "doc_values_in_bytes": 0,
  133. "points": "0b",
  134. "points_in_bytes": 0,
  135. "norms": "2.3kb",
  136. "norms_in_bytes": 2356,
  137. "term_vectors": "2.2kb",
  138. "term_vectors_in_bytes": 2310
  139. },
  140. "context.keyword": {...},
  141. "message": {...},
  142. "message.keyword": {...}
  143. }
  144. }
  145. }
  146. --------------------------------------------------
  147. // TESTRESPONSE[s/: \{\.\.\.\}/: $body.$_path/]
  148. // TESTRESPONSE[s/: (\-)?[0-9]+/: $body.$_path/]
  149. // TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
  150. <1> The store size of only analyzed shards of the index.
  151. <2> The total size of fields of the analyzed shards of the index. This total
  152. is usually smaller than the index size specified in <1> as some small metadata
  153. files are ignored and some parts of data files might not be scanned by the API.
  154. <3> The stored size of the `_id` field
  155. <4> The stored size of the `_source` field. As stored fields are stored
  156. together in a compressed format, the estimated sizes of stored fields are
  157. best efforts and can be inaccurate. The stored size of the `_id` field
  158. is likely underestimated while the `_source` field is overestimated.