segments.asciidoc 4.0 KB

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