anchor.diff:  become `active`. At that  point, Elasticsearch will try to allocate any
   replicas and may decide to relocate the primary shard to another node.
   
  -[float]
  -==== Wait For Active Shards
  +
  +[[shrink-wait-active-shards]]
  +===== Wait for active shards
   
   Because the shrink operation creates a new index to shrink the shards to,
   the <<create-index-wait-for-active-shards,wait for active shards>> setting
   on index creation applies to the shrink index action as well.
  +
  +
  +[[shrink-index-api-path-params]]
  +==== {api-path-parms-title}
  +
  +`<index>`::
  +(Required, string)
  +Name of the source index to shrink.
  +
  +include::{docdir}/rest-api/common-parms.asciidoc[tag=target-index]
  +
  +[[shrink-index-api-query-params]]
  +==== {api-query-parms-title}
  +
  +include::{docdir}/rest-api/common-parms.asciidoc[tag=wait_for_active_shards]
  +
  +include::{docdir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  +
  +
  +[[shrink-index-api-request-body]]
  +==== {api-request-body-title}
  +
  +include::{docdir}/rest-api/common-parms.asciidoc[tag=target-index-aliases]
  +
  +include::{docdir}/rest-api/common-parms.asciidoc[tag=target-index-settings]
  
positive.code: 
  [source,console]
  --------------------------------------------------
  POST my_source_index/_shrink/my_target_index
  {
    "settings": {
      "index.number_of_replicas": 1,
  
negative.code: ++++
  <titleabbrev>Shrink index</titleabbrev>
  ++++
  
  Shrinks an existing index into a new index with fewer primary shards.
  
  
  [source,console]
  ----
  POST /twitter/_shrink/shrunk-twitter-index
  ----
  // TEST[s/^/PUT twitter\n{"settings":{"index.number_of_shards":2,"blocks.write":true}}\n/]
  
  
  [[shrink-index-api-request]]
  ==== {api-request-title}
  
  `POST /<index>/_shrink/<target-index>`
  
  `PUT /<index>/_shrink/<target-index>`
  
  
  [[shrink-index-api-prereqs]]
  ==== {api-prereq-title}
  
  Before you can shrink an index:
  
  * The index must be read-only.
  * A copy of every shard in the index must reside on the same node.
  * The <<cluster-health, cluster health>> status must be green.
  
  These three conditions can be achieved with the following request:
  
  [source,console]
  --------------------------------------------------
  PUT /my_source_index/_settings
  {
    "settings": {
      "index.routing.allocation.require._name": "shrink_node_name", <1>
      "index.blocks.write": true <2>
    }
  }
  --------------------------------------------------
  // TEST[s/^/PUT my_source_index\n{"settings":{"index.number_of_shards":2}}\n/]
  
  <1> Forces the relocation of a copy of each shard to the node with name
      `shrink_node_name`.  See <<shard-allocation-filtering>> for more options.
  
  <2> Prevents write operations to this index while still allowing metadata
      changes like deleting the index.
  
  It can take a while to relocate the source index.  Progress can be tracked
  with the <<cat-recovery,`_cat recovery` API>>, or the <<cluster-health,
  `cluster health` API>> can be used to wait until all shards have relocated
  with the `wait_for_no_relocating_shards` parameter.
  
  
  [[shrink-index-api-desc]]
  ==== {api-description-title}
  
  The shrink index API allows you to shrink an existing index into a new index
  with fewer primary shards. The requested number of primary shards in the target index
  