Snippet - Allocation

Delayed allocation

PUT /_all/_settings?pretty
{
  "settings": {
    "index.unassigned.node_left.delayed_timeout": "10m"
  }
}

Resize replicas

# Temporary single-copy mode; restore the replica count after the operation.
PUT /INDEX_NAME/_settings
{
  "settings": {
    "index.number_of_replicas": 0
  }
}

Slow logs

# TRACE thresholds are verbose; keep them enabled only during diagnosis.
PUT /INDEX_NAME/_settings
{
  "index.indexing.slowlog.threshold.index.warn": "10s",
  "index.indexing.slowlog.threshold.index.info": "5s",
  "index.indexing.slowlog.threshold.index.debug": "2s",
  "index.indexing.slowlog.threshold.index.trace": "100ms",
  "index.search.slowlog.threshold.query.warn": "10s",
  "index.search.slowlog.threshold.query.info": "5s",
  "index.search.slowlog.threshold.query.debug": "2s",
  "index.search.slowlog.threshold.query.trace": "100ms",
  "index.search.slowlog.threshold.fetch.warn": "1s",
  "index.search.slowlog.threshold.fetch.info": "800ms",
  "index.search.slowlog.threshold.fetch.debug": "500ms",
  "index.search.slowlog.threshold.fetch.trace": "50ms"
}

Exclude a node

PUT /_cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.exclude._ip": "10.25.241.17"
  }
}

PUT /_cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.exclude._ip": null
  }
}

Require an index attribute

PUT /INDEX_NAME/_settings
{
  "index.routing.allocation.require.cloud": "azure"
}

PUT /INDEX_NAME/_settings
{
  "index.routing.allocation.require.cloud": "gcp"
}

Data tier

# Tier preference and fallback order: cold, warm, hot.
PUT /INDEX_NAME/_settings
{
  "index.routing.allocation.include._tier_preference": "data_cold,data_warm,data_hot"
}