Skip to content

elasticsearch shrink-index

Shrink an existing index

Description

Shrinks an existing index into a new index with fewer primary shards

Synopsis

elasticsearch shrink-index
    [--site <site>]
    [--cluster <cluster>]
    <index>
    --target_index <target_index>
    [--shards <shards>]
    [--replicas <replicas>]

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

index - (string)

     Name of the index to be shrunk
     Example: "students"
     Default: _None_      Attributes: required

target_index - (string)

     Name for the shrunk index. This shouldn't already exist in the cluster
     Example: --target_index "students-shrunk"
     Default: _None_      Attributes: required

shards - (int)

     Primary shard count in target index. Must be lesser and a factor of source index primary shards
     Example: --shards 1
     Default: 1      Attributes: optional

replicas - (int)

     Replica count in target index
     Example: --replicas 1
     Default: 1      Attributes: optional

Examples

Input:

x = ! elasticsearch shrink-index "testingindex" --target_index "shrunktestingindex" --shards 1
Output:
{
  "acknowledged": true,
  "shards_acknowledged": true,
  "index": "shrunktestingindex"
}

Access Control

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

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

Please see Access Control for details.