diskusage.asciidoc 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. `run_expensive_tasks`::
  44. (Required, Boolean) Analyzing field disk usage is resource-intensive. To use the
  45. API, this parameter must be set to `true`. Defaults to `false`.
  46. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=wait_for_active_shards]
  47. [[analyze-index-disk-usage-api-example]]
  48. ==== {api-examples-title}
  49. [source,console]
  50. --------------------------------------------------
  51. POST /my-index-000001/_disk_usage?run_expensive_tasks=true
  52. --------------------------------------------------
  53. // TEST[setup:messages]
  54. The API returns:
  55. [source,console-response]
  56. --------------------------------------------------
  57. {
  58. "_shards": {
  59. "total": 1,
  60. "successful": 1,
  61. "failed": 0
  62. },
  63. "my-index-000001": {
  64. "store_size": "929mb", <1>
  65. "store_size_in_bytes": 974192723,
  66. "all_fields": {
  67. "total": "928.9mb", <2>
  68. "total_in_bytes": 973977084,
  69. "inverted_index": {
  70. "total": "107.8mb",
  71. "total_in_bytes": 113128526
  72. },
  73. "stored_fields": "623.5mb",
  74. "stored_fields_in_bytes": 653819143,
  75. "doc_values": "125.7mb",
  76. "doc_values_in_bytes": 131885142,
  77. "points": "59.9mb",
  78. "points_in_bytes": 62885773,
  79. "norms": "2.3kb",
  80. "norms_in_bytes": 2356,
  81. "term_vectors": "2.2kb",
  82. "term_vectors_in_bytes": 2310
  83. },
  84. "fields": {
  85. "_id": {
  86. "total": "49.3mb",
  87. "total_in_bytes": 51709993,
  88. "inverted_index": {
  89. "total": "29.7mb",
  90. "total_in_bytes": 31172745
  91. },
  92. "stored_fields": "19.5mb", <3>
  93. "stored_fields_in_bytes": 20537248,
  94. "doc_values": "0b",
  95. "doc_values_in_bytes": 0,
  96. "points": "0b",
  97. "points_in_bytes": 0,
  98. "norms": "0b",
  99. "norms_in_bytes": 0,
  100. "term_vectors": "0b",
  101. "term_vectors_in_bytes": 0
  102. },
  103. "_primary_term": {...},
  104. "_seq_no": {...},
  105. "_version": {...},
  106. "_source": {
  107. "total": "603.9mb",
  108. "total_in_bytes": 633281895,
  109. "inverted_index": {...},
  110. "stored_fields": "603.9mb", <4>
  111. "stored_fields_in_bytes": 633281895,
  112. "doc_values": "0b",
  113. "doc_values_in_bytes": 0,
  114. "points": "0b",
  115. "points_in_bytes": 0,
  116. "norms": "0b",
  117. "norms_in_bytes": 0,
  118. "term_vectors": "0b",
  119. "term_vectors_in_bytes": 0
  120. },
  121. "context": {
  122. "total": "28.6mb",
  123. "total_in_bytes": 30060405,
  124. "inverted_index": {
  125. "total": "22mb",
  126. "total_in_bytes": 23090908
  127. },
  128. "stored_fields": "0b",
  129. "stored_fields_in_bytes": 0,
  130. "doc_values": "0b",
  131. "doc_values_in_bytes": 0,
  132. "points": "0b",
  133. "points_in_bytes": 0,
  134. "norms": "2.3kb",
  135. "norms_in_bytes": 2356,
  136. "term_vectors": "2.2kb",
  137. "term_vectors_in_bytes": 2310
  138. },
  139. "context.keyword": {...},
  140. "message": {...},
  141. "message.keyword": {...}
  142. }
  143. }
  144. }
  145. --------------------------------------------------
  146. // TESTRESPONSE[s/: \{\.\.\.\}/: $body.$_path/]
  147. // TESTRESPONSE[s/: (\-)?[0-9]+/: $body.$_path/]
  148. // TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
  149. <1> The store size of only analyzed shards of the index.
  150. <2> The total size of fields of the analyzed shards of the index. This total
  151. is usually smaller than the index size specified in <1> as some small metadata
  152. files are ignored and some parts of data files might not be scanned by the API.
  153. <3> The stored size of the `_id` field
  154. <4> The stored size of the `_source` field. As stored fields are stored
  155. together in a compressed format, the estimated sizes of stored fields are
  156. best efforts and can be inaccurate. The stored size of the `_id` field
  157. is likely underestimated while the `_source` field is overestimated.