segments.asciidoc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. [[cat-segments]]
  2. === cat segments API
  3. ++++
  4. <titleabbrev>cat segments</titleabbrev>
  5. ++++
  6. .New API reference
  7. [sidebar]
  8. --
  9. For the most up-to-date API details, refer to {api-es}/group/endpoint-cat[Compact and aligned text (CAT) APIs]..
  10. --
  11. [IMPORTANT]
  12. ====
  13. cat APIs are only intended for human consumption using the command line or {kib}
  14. console. They are _not_ intended for use by applications. For application
  15. consumption, use the <<indices-segments,index segments API>>.
  16. ====
  17. Returns low-level information about the https://lucene.apache.org/core/[Lucene]
  18. segments in index shards, similar to the <<indices-segments, indices segments>>
  19. API.
  20. For data streams, the API returns information about the stream's backing
  21. indices.
  22. [[cat-segments-api-request]]
  23. ==== {api-request-title}
  24. `GET /_cat/segments/<target>`
  25. `GET /_cat/segments`
  26. [[cat-segments-api-prereqs]]
  27. ==== {api-prereq-title}
  28. * If the {es} {security-features} are enabled, you must have the `monitor` or
  29. `manage` <<privileges-list-cluster,cluster privilege>> to use this API. You must
  30. also have the `monitor` or `manage` <<privileges-list-indices,index privilege>>
  31. for any data stream, index, or alias you retrieve.
  32. [[cat-segments-path-params]]
  33. ==== {api-path-parms-title}
  34. `<target>`::
  35. (Optional, string) Comma-separated list of data streams, indices, and aliases
  36. used to limit the request. Supports wildcards (`*`). To target all data streams
  37. and indices, omit this parameter or use `*` or `_all`.
  38. [[cat-segments-query-params]]
  39. ==== {api-query-parms-title}
  40. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=bytes]
  41. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=http-format]
  42. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
  43. +
  44. --
  45. If you do not specify which columns to include, the API returns the default
  46. columns in the order listed below. If you explicitly specify one or more
  47. columns, it only returns the specified columns.
  48. Valid columns are:
  49. `index`, `i`, `idx`::
  50. (Default) Name of the index.
  51. `shard`, `s`, `sh`::
  52. (Default) Name of the shard.
  53. `prirep`, `p`, `pr`, `primaryOrReplica`::
  54. (Default) Shard type. Returned values are `primary` or `replica`.
  55. `ip`::
  56. (Default) IP address of the segment's shard, such as `127.0.1.1`.
  57. `segment`::
  58. (Default)
  59. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=segment]
  60. `generation`::
  61. (Default)
  62. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=generation]
  63. `docs.count`::
  64. (Default)
  65. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=docs-count]
  66. `docs.deleted`::
  67. (Default)
  68. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=docs-deleted]
  69. `size`::
  70. (Default)
  71. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=segment-size]
  72. `size.memory`::
  73. (Default)
  74. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=memory]
  75. `committed`::
  76. (Default)
  77. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=committed]
  78. `searchable`::
  79. (Default)
  80. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=segment-search]
  81. `version`::
  82. (Default)
  83. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=segment-version]
  84. `compound`::
  85. (Default) If `true`, the segment is stored in a compound file. This means Lucene
  86. merged all files from the segment in a single file to save file descriptors.
  87. `id`::
  88. ID of the node, such as `k0zy`.
  89. --
  90. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=help]
  91. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
  92. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
  93. [[cat-segments-api-example]]
  94. ==== {api-examples-title}
  95. [source,console]
  96. --------------------------------------------------
  97. GET /_cat/segments?v=true
  98. --------------------------------------------------
  99. // TEST[s/^/PUT \/test\/_doc\/1?refresh\n{"test":"test"}\nPUT \/test1\/_doc\/1?refresh\n{"test":"test"}\n/]
  100. The API returns the following response:
  101. ["source","txt",subs="attributes,callouts"]
  102. --------------------------------------------------
  103. index shard prirep ip segment generation docs.count docs.deleted size size.memory committed searchable version compound
  104. test 0 p 127.0.0.1 _0 0 1 0 3kb 0 false true {lucene_version} true
  105. test1 0 p 127.0.0.1 _0 0 1 0 3kb 0 false true {lucene_version} true
  106. --------------------------------------------------
  107. // TESTRESPONSE[s/3kb/\\d+(\\.\\d+)?[mk]?b/ s/2042/\\d+/ non_json]