Skip to content

Instantly share code, notes, and snippets.

@anastazya
Forked from angristan/single-node-es.md
Created April 4, 2022 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anastazya/e1d15e41a86be56cd5f3893657c11a27 to your computer and use it in GitHub Desktop.
Save anastazya/e1d15e41a86be56cd5f3893657c11a27 to your computer and use it in GitHub Desktop.
Elasticsearch settings for single-node cluster (1 shard, 0 replica)

Elasticsearch settings for single-node cluster

1 shard, 0 replica.

For future indices

Update default template:

curl -X PUT http://localhost:9200/_template/default -H 'Content-Type: application/json' -d '{"index_patterns": ["*"],"order": -1,"settings": {"number_of_shards": "1","number_of_replicas": "0"}}' 

For existing indices

If yellow indices exist, you can update them with:

curl -X PUT http://localhost:9200/_settings -H 'Content-Type: application/json' -d '{"index": {"number_of_shards": "1","number_of_replicas": "0"}}'

If you get this error:

{"error":{"root_cause":[{"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"}],"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"},"status":403}

You can fix it with:

curl -X PUT http://localhost:9200/_settings -H 'Content-Type: application/json' -d '{"index": {"blocks": {"read_only_allow_delete": "false"}}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment