Skip to content

Instantly share code, notes, and snippets.

@angristan
Last active July 12, 2025 16:46
Show Gist options
  • Save angristan/9d251d853d11f265899b8a4725bff756 to your computer and use it in GitHub Desktop.
Save angristan/9d251d853d11f265899b8a4725bff756 to your computer and use it in GitHub Desktop.

Revisions

  1. angristan revised this gist Feb 19, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion single-node-es.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    # Elasticsearch settings for single-node cluster (1 shard, 0 replica)
    # Elasticsearch settings for single-node cluster

    1 shard, 0 replica.

    ## For future indices

  2. angristan revised this gist Feb 19, 2019. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion single-node-es.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,16 @@
    # Elasticsearch settings for single-node cluster (1 shard, 0 replica)

    ## For future indices

    Update default template:

    ```sh
    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"}}'
    ```

    If yellow indices exist, set the number of replicas to 0:
    ## For existing indices

    If yellow indices exist, you can update them with:

    ```sh
    curl -X PUT http://localhost:9200/_settings -H 'Content-Type: application/json' -d '{"index": {"number_of_shards": "1","number_of_replicas": "0"}}'
  3. angristan revised this gist Feb 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion single-node-es.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ curl -X PUT http://localhost:9200/_template/default -H 'Content-Type: applicatio

    If yellow indices exist, set the number of replicas to 0:

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

  4. angristan revised this gist Feb 19, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions single-node-es.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    Update default template:

    ```sh
    curl -X PUT "localhost:9200/_template/default" -H 'Content-Type: application/json' -d '{"index_patterns": ["*"],"order": -1,"settings": {"number_of_shards": "1","number_of_replicas": "0"}}'
    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"}}'
    ```

    If yellow indices exist, set the number of replicas to 0:

    ```
    curl -XPUT http://localhost:9200/_settings -H 'Content-Type: application/json' -d '{"index": {"number_of_shards": "1","number_of_replicas": "0"}}'
    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:
    @@ -19,6 +19,6 @@ If you get this error:
    You can fix it with:

    ```sh
    curl -XPUT http://localhost:9200/_settings -H 'Content-Type: application/json' -d '{"index": {"blocks": {"read_only_allow_delete": "false"}}}'
    curl -X PUT http://localhost:9200/_settings -H 'Content-Type: application/json' -d '{"index": {"blocks": {"read_only_allow_delete": "false"}}}'
    ```

  5. angristan revised this gist Feb 19, 2019. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions single-node-es.md
    Original file line number Diff line number Diff line change
    @@ -4,19 +4,19 @@ Update default template:
    curl -X PUT "localhost:9200/_template/default" -H 'Content-Type: application/json' -d '{"index_patterns": ["*"],"order": -1,"settings": {"number_of_shards": "1","number_of_replicas": "0"}}'
    ```

    If yellow indices exist:
    If yellow indices exist, set the number of replicas to 0:

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

    If you get this:
    If you get this error:

    ```json
    {"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}
    ```

    Then:
    You can fix it with:

    ```sh
    curl -XPUT http://localhost:9200/_settings -H 'Content-Type: application/json' -d '{"index": {"blocks": {"read_only_allow_delete": "false"}}}'
  6. angristan created this gist Feb 19, 2019.
    24 changes: 24 additions & 0 deletions single-node-es.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    Update default template:

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

    If yellow indices exist:

    ```
    curl -XPUT http://localhost:9200/_settings -H 'Content-Type: application/json' -d '{"index": {"number_of_replicas": 0}}'
    ```

    If you get this:

    ```json
    {"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}
    ```

    Then:

    ```sh
    curl -XPUT http://localhost:9200/_settings -H 'Content-Type: application/json' -d '{"index": {"blocks": {"read_only_allow_delete": "false"}}}'
    ```