segments.asciidoc 4.0 KB

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