Skip to content

Throw exception for unsupported values type in Alias #124737

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mushao999
Copy link
Contributor

After creating index with alias using the following request

PUT test-index
{
  "aliases": {
    "alias1": {
      "is_write_index": "true"
    }
  }
}

we got the following result for get index request:

{
  "test-index" : {
    "aliases" : {
      "alias1" : { }
    },
    "mappings" : { },
    "settings" : {   
      ...
    }
  }
}

The is_write_index field is missing because string boolean value is not supported for this filed and no warning message showed, which will mislead the users.
In #120453 I open a PR to let the createIndex API support string boolean values for is_write_index field, but @dakrone think it's better to be strict about boolean values.
So I open this PR to let the Alias class throw exception for the unsupport value type to avoid the slience swallowing of this case.

@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label external-contributor Pull request authored by a developer outside the Elasticsearch team v9.1.0 labels Mar 13, 2025
@dakrone dakrone added the :Data Management/Indices APIs APIs to create and manage indices and templates label Mar 13, 2025
@elasticsearchmachine elasticsearchmachine added Team:Data Management Meta label for data/management team and removed needs:triage Requires assignment of a team area label labels Mar 13, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@mushao999
Copy link
Contributor Author

ping @dakrone

@dakrone dakrone self-assigned this Mar 20, 2025
Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this @mushao999, it looks pretty good. Would you mind adding a test for this to …/indices.put_alias/10_basic.yml that ensures that a bad request is returned? That way we don't accidentally undo this in the future without checking it.

@dakrone
Copy link
Member

dakrone commented Mar 21, 2025

buildkite test this

@dakrone dakrone added the >bug label Mar 21, 2025
@mushao999
Copy link
Contributor Author

Thanks for opening this @mushao999, it looks pretty good. Would you mind adding a test for this to …/indices.put_alias/10_basic.yml that ensures that a bad request is returned? That way we don't accidentally undo this in the future without checking it.

yamlRestTest case added @dakrone

@mushao999
Copy link
Contributor Author

Please also review this one , thanks @dakrone

@dakrone
Copy link
Member

dakrone commented Apr 10, 2025

buildkite test this

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@dakrone dakrone added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Apr 10, 2025
@mushao999
Copy link
Contributor Author

@dakrone Cluster feature was added for BWC tests, please also enable the auto-testing for this one, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >bug :Data Management/Indices APIs APIs to create and manage indices and templates external-contributor Pull request authored by a developer outside the Elasticsearch team Team:Data Management Meta label for data/management team v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants