Skip to content

elasticsearch get-index-segments

Get elastic search index segments

Description

Get low-level information about the Lucene segments in index shards

Synopsis

elasticsearch get-index-segments
    [--site <site>]
    [--cluster <cluster>]
    [--filter_path <filter_path>]
    [--raw]
    [--verbose]
    [<index>]

Arguments

site - (string)

     Site where this command will be executed
     Example: --site "site-1"
     Default: input.site      Attributes: optional

cluster - (string)

     Name of elastic search cluster
     Example: --cluster "elastic-default"
     Default: elastic-default      Attributes: optional

filter_path - (string)

     Path in the response. Filters and returns only parts of response matching this path
     Example: --filter_path "index.mappings.properties.*"
     Default: _None_      Attributes: optional, multiple allowed

raw - (bool)

     If false, returns compact and aligned text output
     Example: --raw
     Default: _None_      Attributes: optional

verbose - (bool)

     Get additional debugging information
     Example: --verbose
     Default: _None_      Attributes: optional

index - (string)

     Name of the index
     Example: "students"
     Default: _all      Attributes: optional, multiple allowed

Examples

Input:

! elasticsearch get-index-segments --cluster "elastic-1" "students" --verbose --raw 
Output:
{
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  },
  "indices": {
    "students": {
      "shards": {
        "0": [
          {
            "routing": {
              "state": "STARTED",
              "primary": true,
              "node": "qQmwEJbkTdW-ixce6PgTFQ"
            },
            "num_committed_segments": 1,
            "num_search_segments": 1,
            "segments": {
              "_0": {
                "generation": 0,
                "num_docs": 4,
                "deleted_docs": 0,
                "size_in_bytes": 4165,
                "memory_in_bytes": 1188,
                "committed": true,
                "search": true,
                "version": "8.9.0",
                "compound": true,
                "ram_tree": [
                  {
                    "description": "postings [PerFieldPostings(segment=_0 formats=1)]",
                    "size_in_bytes": 512,
                    "children": [
                      {
                        "description": "format 'Lucene84_0' [BlockTreeTermsReader(fields=2,delegate=Lucene84PostingsReader(positions=true,payloads=false))]",
                        "size_in_bytes": 464,
                        "children": [
                          {
                            "description": "field '_id' [BlockTreeTerms(seg=_0 terms=4,postings=4,positions=4,docs=4)]",
                            "size_in_bytes": 216,
                            "children": [
                              {
                                "description": "term index [FST(input=BYTE1,output=ByteSequenceOutputs]",
                                "size_in_bytes": 72
                              }
                            ]
                          },
                          {
                            "description": "field 'name' [BlockTreeTerms(seg=_0 terms=5,postings=6,positions=6,docs=4)]",
                            "size_in_bytes": 216,
                            "children": [
                              {
                                "description": "term index [FST(input=BYTE1,output=ByteSequenceOutputs]",
                                "size_in_bytes": 72
                              }
                            ]
                          },
                          {
                            "description": "delegate [Lucene84PostingsReader(positions=true,payloads=false)]",
                            "size_in_bytes": 32
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "description": "norms [Lucene80NormsProducer(fields=1)]",
                    "size_in_bytes": 64
                  },
                  {
                    "description": "docvalues [PerFieldDocValues(formats=1)]",
                    "size_in_bytes": 124,
                    "children": [
                      {
                        "description": "format 'Lucene80_0' [org.apache.lucene.codecs.lucene80.Lucene80DocValuesProducer@378ad8c7]",
                        "size_in_bytes": 104
                      }
                    ]
                  },
                  {
                    "description": "stored fields [CompressingStoredFieldsReader(mode=BEST_SPEED,chunksize=614400)]",
                    "size_in_bytes": 488,
                    "children": [
                      {
                        "description": "stored field index [org.apache.lucene.codecs.compressing.FieldsIndexReader@6ed117fe]",
                        "size_in_bytes": 488
                      }
                    ]
                  },
                  {
                    "description": "points [org.apache.lucene.codecs.lucene86.Lucene86PointsReader@55fd9d38]",
                    "size_in_bytes": 0
                  }
                ],
                "attributes": {
                  "Lucene87StoredFieldsFormat.mode": "BEST_SPEED"
                }
              }
            }
          }
        ]
      }
    }
  }
}
Input:
! elasticsearch get-index-segments
Output:
[
  {
    "index": ".geoip_databases",
    "shard": "0",
    "prirep": "p",
    "ip": "127.0.0.1",
    "segment": "_ah",
    "generation": "377",
    "docs.count": "42",
    "docs.deleted": "3",
    "size": "41.1mb",
    "size.memory": "1460",
    "committed": "true",
    "searchable": "true",
    "version": "8.9.0",
    "compound": "false"
  },
  {
    "index": "my-index-000001",
    "shard": "0",
    "prirep": "p",
    "ip": "127.0.0.1",
    "segment": "_3",
    "generation": "3",
    "docs.count": "2",
    "docs.deleted": "1",
    "size": "6.2kb",
    "size.memory": "2092",
    "committed": "true",
    "searchable": "true",
    "version": "8.9.0",
    "compound": "true"
  },
  {
    "index": "my-index-000001",
    "shard": "0",
    "prirep": "p",
    "ip": "127.0.0.1",
    "segment": "_7",
    "generation": "7",
    "docs.count": "1",
    "docs.deleted": "0",
    "size": "4.6kb",
    "size.memory": "1876",
    "committed": "true",
    "searchable": "true",
    "version": "8.9.0",
    "compound": "true"
  },
  {
    "index": "my-index-000001",
    "shard": "0",
    "prirep": "p",
    "ip": "127.0.0.1",
    "segment": "_8",
    "generation": "8",
    "docs.count": "1",
    "docs.deleted": "0",
    "size": "4.6kb",
    "size.memory": "1876",
    "committed": "true",
    "searchable": "true",
    "version": "8.9.0",
    "compound": "true"
  },
  {
    "index": "my-index-000001",
    "shard": "0",
    "prirep": "p",
    "ip": "127.0.0.1",
    "segment": "_9",
    "generation": "9",
    "docs.count": "1",
    "docs.deleted": "0",
    "size": "4.1kb",
    "size.memory": "1876",
    "committed": "true",
    "searchable": "true",
    "version": "8.9.0",
    "compound": "true"
  }
]

Access Control

To use this command, you need access to the following:

Field Value
Action "read"
Service Type "elasticsearch"
Service Instance cluster
Namespace
Object Type "index"
Object ID index

Please see Access Control for details.