2015-01-07 07:51:09 -05:00
|
|
|
[[cat-segments]]
|
2019-07-19 14:35:36 -04:00
|
|
|
=== cat segments
|
2015-01-07 07:51:09 -05:00
|
|
|
|
|
|
|
The `segments` command provides low level information about the segments
|
|
|
|
in the shards of an index. It provides information similar to the
|
2016-10-25 10:56:30 -04:00
|
|
|
link:indices-segments.html[_segments] endpoint. For example:
|
2015-01-07 07:51:09 -05:00
|
|
|
|
2016-10-25 10:56:30 -04:00
|
|
|
[source,js]
|
2015-01-07 07:51:09 -05:00
|
|
|
--------------------------------------------------
|
2016-10-25 10:56:30 -04:00
|
|
|
GET /_cat/segments?v
|
2015-01-07 07:51:09 -05:00
|
|
|
--------------------------------------------------
|
2016-10-25 10:56:30 -04:00
|
|
|
// CONSOLE
|
|
|
|
// TEST[s/^/PUT \/test\/test\/1?refresh\n{"test":"test"}\nPUT \/test1\/test\/1?refresh\n{"test":"test"}\n/]
|
2015-01-07 07:51:09 -05:00
|
|
|
|
2016-10-25 10:56:30 -04:00
|
|
|
might look like:
|
|
|
|
|
|
|
|
["source","txt",subs="attributes,callouts"]
|
2015-01-07 07:51:09 -05:00
|
|
|
--------------------------------------------------
|
2016-10-25 10:56:30 -04:00
|
|
|
index shard prirep ip segment generation docs.count docs.deleted size size.memory committed searchable version compound
|
2018-05-14 12:22:35 -04:00
|
|
|
test 0 p 127.0.0.1 _0 0 1 0 3kb 2042 false true {lucene_version} true
|
|
|
|
test1 0 p 127.0.0.1 _0 0 1 0 3kb 2042 false true {lucene_version} true
|
2015-01-07 07:51:09 -05:00
|
|
|
--------------------------------------------------
|
2019-06-10 09:33:32 -04:00
|
|
|
// TESTRESPONSE[s/3kb/\\d+(\\.\\d+)?[mk]?b/ s/2042/\\d+/ non_json]
|
2015-01-07 07:51:09 -05:00
|
|
|
|
|
|
|
The output shows information about index names and shard numbers in the first
|
|
|
|
two columns.
|
|
|
|
|
|
|
|
If you only want to get information about segments in one particular index,
|
|
|
|
you can add the index name in the URL, for example `/_cat/segments/test`. Also,
|
|
|
|
several indexes can be queried like `/_cat/segments/test,test1`
|
|
|
|
|
|
|
|
|
|
|
|
The following columns provide additional monitoring information:
|
|
|
|
|
|
|
|
prirep:: Whether this segment belongs to a primary or replica shard.
|
|
|
|
|
2017-02-16 14:41:42 -05:00
|
|
|
ip:: The ip address of the segment's shard.
|
2015-01-07 07:51:09 -05:00
|
|
|
|
|
|
|
segment:: A segment name, derived from the segment generation. The name
|
|
|
|
is internally used to generate the file names in the directory
|
|
|
|
of the shard this segment belongs to.
|
|
|
|
|
|
|
|
generation:: The generation number is incremented with each segment that is written.
|
|
|
|
The name of the segment is derived from this generation number.
|
|
|
|
|
|
|
|
docs.count:: The number of non-deleted documents that are stored in this segment.
|
2016-04-07 05:15:32 -04:00
|
|
|
Note that these are Lucene documents, so the count will include hidden
|
|
|
|
documents (e.g. from nested types).
|
2015-01-07 07:51:09 -05:00
|
|
|
|
|
|
|
docs.deleted:: The number of deleted documents that are stored in this segment.
|
|
|
|
It is perfectly fine if this number is greater than 0, space is
|
|
|
|
going to be reclaimed when this segment gets merged.
|
|
|
|
|
|
|
|
size:: The amount of disk space that this segment uses.
|
|
|
|
|
|
|
|
size.memory:: Segments store some data into memory in order to be searchable efficiently.
|
|
|
|
This column shows the number of bytes in memory that are used.
|
|
|
|
|
|
|
|
committed:: Whether the segment has been sync'ed on disk. Segments that are
|
|
|
|
committed would survive a hard reboot. No need to worry in case
|
|
|
|
of false, the data from uncommitted segments is also stored in
|
|
|
|
the transaction log so that Elasticsearch is able to replay
|
|
|
|
changes on the next start.
|
|
|
|
|
|
|
|
searchable:: True if the segment is searchable. A value of false would most
|
|
|
|
likely mean that the segment has been written to disk but no
|
|
|
|
refresh occurred since then to make it searchable.
|
|
|
|
|
|
|
|
version:: The version of Lucene that has been used to write this segment.
|
|
|
|
|
|
|
|
compound:: Whether the segment is stored in a compound file. When true, this
|
|
|
|
means that Lucene merged all files from the segment in a single
|
|
|
|
one in order to save file descriptors.
|