2015-01-07 20:51:09 +08:00
|
|
|
[[cat-segments]]
|
2019-08-13 20:35:08 +08:00
|
|
|
=== cat segments API
|
|
|
|
++++
|
|
|
|
<titleabbrev>cat segments</titleabbrev>
|
|
|
|
++++
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
Returns low-level information about the https://lucene.apache.org/core/[Lucene]
|
|
|
|
segments in index shards, similar to the <<indices-segments, indices segments>>
|
|
|
|
API.
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2020-07-01 03:06:51 +08:00
|
|
|
For data streams, the API returns information about the stream's backing
|
|
|
|
indices.
|
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
[[cat-segments-api-request]]
|
|
|
|
==== {api-request-title}
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2020-07-01 03:06:51 +08:00
|
|
|
`GET /_cat/segments/<target>`
|
2016-10-25 22:56:30 +08:00
|
|
|
|
2019-10-10 20:29:27 +08:00
|
|
|
`GET /_cat/segments`
|
|
|
|
|
2021-01-20 23:19:20 +08:00
|
|
|
[[cat-segments-api-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
* If the {es} {security-features} are enabled, you must have the `monitor` or
|
|
|
|
`manage` <<privileges-list-cluster,cluster privilege>> to use this API. You must
|
|
|
|
also have the `monitor` or `manage` <<privileges-list-indices,index privilege>>
|
2021-05-28 04:00:57 +08:00
|
|
|
for any data stream, index, or alias you retrieve.
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
[[cat-segments-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
2020-07-01 03:06:51 +08:00
|
|
|
`<target>`::
|
2021-05-28 04:00:57 +08:00
|
|
|
(Optional, string) Comma-separated list of data streams, indices, and aliases
|
|
|
|
used to limit the request. Supports wildcards (`*`). To target all data streams
|
|
|
|
and indices, omit this parameter or use `*` or `_all`.
|
2019-08-12 20:25:09 +08:00
|
|
|
|
|
|
|
[[cat-segments-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
|
|
|
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bytes]
|
2019-08-12 20:25:09 +08:00
|
|
|
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=http-format]
|
2019-08-12 20:25:09 +08:00
|
|
|
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
|
2019-08-12 20:25:09 +08:00
|
|
|
+
|
|
|
|
--
|
|
|
|
If you do not specify which columns to include, the API returns the default
|
|
|
|
columns in the order listed below. If you explicitly specify one or more
|
|
|
|
columns, it only returns the specified columns.
|
|
|
|
|
|
|
|
Valid columns are:
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`index`, `i`, `idx`::
|
2020-08-03 21:26:17 +08:00
|
|
|
(Default) Name of the index.
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`shard`, `s`, `sh`::
|
|
|
|
(Default) Name of the shard.
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`prirep`, `p`, `pr`, `primaryOrReplica`::
|
|
|
|
(Default) Shard type. Returned values are `primary` or `replica`.
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`ip`::
|
|
|
|
(Default) IP address of the segment's shard, such as `127.0.1.1`.
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`segment`::
|
2019-09-05 20:33:17 +08:00
|
|
|
(Default)
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=segment]
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`generation`::
|
2019-09-05 20:33:17 +08:00
|
|
|
(Default)
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=generation]
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`docs.count`::
|
2019-09-05 20:33:17 +08:00
|
|
|
(Default)
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=docs-count]
|
2019-08-12 20:25:09 +08:00
|
|
|
|
|
|
|
`docs.deleted`::
|
2019-09-05 20:33:17 +08:00
|
|
|
(Default)
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=docs-deleted]
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`size`::
|
2019-09-05 20:33:17 +08:00
|
|
|
(Default)
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=segment-size]
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`size.memory`::
|
2019-09-05 20:33:17 +08:00
|
|
|
(Default)
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=memory]
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`committed`::
|
2019-09-05 20:33:17 +08:00
|
|
|
(Default)
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=committed]
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`searchable`::
|
2019-09-05 20:33:17 +08:00
|
|
|
(Default)
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=segment-search]
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`version`::
|
2019-09-05 20:33:17 +08:00
|
|
|
(Default)
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=segment-version]
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`compound`::
|
|
|
|
(Default) If `true`, the segment is stored in a compound file. This means Lucene
|
|
|
|
merged all files from the segment in a single file to save file descriptors.
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2019-08-12 20:25:09 +08:00
|
|
|
`id`::
|
|
|
|
ID of the node, such as `k0zy`.
|
|
|
|
--
|
2015-01-07 20:51:09 +08:00
|
|
|
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=help]
|
2019-08-12 20:25:09 +08:00
|
|
|
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
|
2019-08-12 20:25:09 +08:00
|
|
|
|
2020-06-02 06:55:05 +08:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
|
2019-08-12 20:25:09 +08:00
|
|
|
|
|
|
|
|
2019-08-13 20:27:57 +08:00
|
|
|
[[cat-segments-api-example]]
|
2019-08-12 20:25:09 +08:00
|
|
|
==== {api-examples-title}
|
|
|
|
|
2019-09-10 01:13:41 +08:00
|
|
|
[source,console]
|
2019-08-12 20:25:09 +08:00
|
|
|
--------------------------------------------------
|
2021-01-12 06:19:23 +08:00
|
|
|
GET /_cat/segments?v=true
|
2019-08-12 20:25:09 +08:00
|
|
|
--------------------------------------------------
|
2019-10-11 17:23:55 +08:00
|
|
|
// TEST[s/^/PUT \/test\/_doc\/1?refresh\n{"test":"test"}\nPUT \/test1\/_doc\/1?refresh\n{"test":"test"}\n/]
|
2019-08-12 20:25:09 +08:00
|
|
|
|
|
|
|
The API returns the following response:
|
|
|
|
|
|
|
|
["source","txt",subs="attributes,callouts"]
|
|
|
|
--------------------------------------------------
|
|
|
|
index shard prirep ip segment generation docs.count docs.deleted size size.memory committed searchable version compound
|
2021-07-29 14:36:09 +08:00
|
|
|
test 0 p 127.0.0.1 _0 0 1 0 3kb 0 false true {lucene_version} true
|
|
|
|
test1 0 p 127.0.0.1 _0 0 1 0 3kb 0 false true {lucene_version} true
|
2019-08-12 20:25:09 +08:00
|
|
|
--------------------------------------------------
|
|
|
|
// TESTRESPONSE[s/3kb/\\d+(\\.\\d+)?[mk]?b/ s/2042/\\d+/ non_json]
|