Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index.number_of_replicas cannot be reset to a default value #56501

Closed
Ingramz opened this issue May 11, 2020 · 6 comments · Fixed by #56656
Closed

index.number_of_replicas cannot be reset to a default value #56501

Ingramz opened this issue May 11, 2020 · 6 comments · Fixed by #56656
Labels
>bug :Data Management/Indices APIs APIs to create and manage indices and templates >docs General docs changes Team:Data Management Meta label for data/management team

Comments

@Ingramz
Copy link

Ingramz commented May 11, 2020

Elasticsearch version (bin/elasticsearch --version): 7.6.2

Plugins installed: []

JVM version (java -version): Bundled

OS version (uname -a if on a Unix-like system): Any

Description of the problem including expected versus actual behavior:

Per documentation, one should be able to reset an index setting to its default value by using null as value. This seems to work for a setting such as refresh_interval, but not for number_of_replicas, resulting in following response:

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "must specify numberOfReplicas for index [twitter]"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "must specify numberOfReplicas for index [twitter]"
    },
    "status": 400
}

It is uncertain whether there are more settings that exhibit this behavior.

Steps to reproduce:

Create Index:

PUT /twitter

Check defaults (see that number_of_replicas is 1):

GET /twitter

Set number_of_replicas temporarily to 0:

PUT /twitter/_settings
{
    "index" : {
        "number_of_replicas" : 0
    }
}

Verify that number_of_replicas is 0:

GET /twitter

Try to reset the value per documentation:

PUT /twitter/_settings
{
    "index" : {
        "number_of_replicas" : null
    }
}

Provide logs (if relevant): N/A

@Ingramz Ingramz added >bug needs:triage Requires assignment of a team area label labels May 11, 2020
@cbuescher cbuescher added :Core/Infra/Settings Settings infrastructure and APIs >docs General docs changes labels May 11, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Settings)

@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label May 11, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs (>docs)

@elasticmachine elasticmachine added the Team:Docs Meta label for docs team label May 11, 2020
@cbuescher cbuescher removed Team:Docs Meta label for docs team needs:triage Requires assignment of a team area label labels May 11, 2020
@cbuescher
Copy link
Member

@Ingramz thanks for raising this, I'm not sure its a bug or the intended behaviour that should be documented better. Labeling accordingly so the team can weigh in.

@jasontedor
Copy link
Member

jasontedor commented May 13, 2020

This is a bug, I opened #56656.

@jasontedor jasontedor added :Data Management/Indices APIs APIs to create and manage indices and templates and removed :Core/Infra/Settings Settings infrastructure and APIs labels May 13, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Indices APIs)

@elasticmachine elasticmachine added Team:Data Management Meta label for data/management team and removed Team:Core/Infra Meta label for core/infra team labels May 13, 2020
@jasontedor
Copy link
Member

I'm relabeling this since this isn't a general problem with the settings infrastructure, but a case for this specific API (the update index settings API).

rjernst added a commit to rjernst/elasticsearch that referenced this issue May 13, 2020
The Setting class provides the ability to define a setting, a default
value, along with validation logic. However, there are still many uses
of thhe old getAsXXX methods on Settings. This commit converts one of
those cases, reading the index number_of_replicas setting, so that the
default is not defined in multiple places.

relates elastic#56656
relates elastic#56501
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Indices APIs APIs to create and manage indices and templates >docs General docs changes Team:Data Management Meta label for data/management team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants