Skip to content

Instantly share code, notes, and snippets.

@LadySmith
Created November 25, 2024 18:46
Show Gist options
  • Select an option

  • Save LadySmith/2153a7736feeb961fede541f437fec34 to your computer and use it in GitHub Desktop.

Select an option

Save LadySmith/2153a7736feeb961fede541f437fec34 to your computer and use it in GitHub Desktop.
Elasticsearch watermark setting

Elasticserach Docs

  1. Check for existing persistent limits:
curl -X GET "http://archivist-es:9200/_cluster/settings" -u elastic:${ELASTIC_PASSWORD}

If limits are already set up, reset them first:

curl -X PUT "http://archivist-es:9200/_cluster/settings" -H 'Content-Type: application/json' -u elastic:${ELASTIC_PASSWORD} -d'
{
  "persistent": {
    "cluster.routing.allocation.disk.watermark.low": null,
    "cluster.routing.allocation.disk.watermark.low.max_headroom": null,
    "cluster.routing.allocation.disk.watermark.high": null,
    "cluster.routing.allocation.disk.watermark.high.max_headroom": null,
    "cluster.routing.allocation.disk.watermark.flood_stage": null,
    "cluster.routing.allocation.disk.watermark.flood_stage.max_headroom": null
  }
}'
  1. Set up your absolute values according to your preferences. Note that you cannot mix percentages with absolute values:
curl -X PUT "http://archivist-es:9200/_cluster/settings" -H 'Content-Type: application/json' -u elastic:${ELASTIC_PASSWORD} -d'
{
  "persistent": {
    "cluster.routing.allocation.disk.watermark.low": "100gb",
    "cluster.routing.allocation.disk.watermark.high": "70gb",
    "cluster.routing.allocation.disk.watermark.flood_stage": "50gb"
  }
}'
  1. Verify the limits:
curl -X GET "http://archivist-es:9200/_cluster/settings" -u elastic:${ELASTIC_PASSWORD}
{
  "persistent": {
    "cluster": {
      "routing": {
        "allocation": {
          "disk": {
            "watermark": {
              "low": "100gb",
              "flood_stage": "50gb",
              "high": "70gb"
            }
          }
        }
      }
    }
  },
  "transient": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment