-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Support boolean string for alias defination in CreateIndex API #120453
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
Conversation
|
https://github.com/elastic/elasticsearch/blob/main/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java#L83-#L89 |
|
Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing) |
|
Pinging @elastic/es-data-management (Team:Data Management) |
|
Pinging @dakrone |
|
Thanks for the ping @mushao999, we discussed this internally as a team. We decided that for now we consider the leniency of allowing string-like booleans to be unfortunate, rather than a leniency to which we want to more closely align. If it were not a breaking change, we'd be more likely to change the alias API to be strict about boolean values, rather than make the create index API more lenient. So for now, I'm going to close this PR, thanks for opening it though! |
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.
We found that boolean strings were not supported for alias defination (is_write_index & is_hidden) in RestCreateIndexAction. However, they are supported in RestIndexPutAliasAction. So I open this PR to allow RestCreateIndexAction to accept boolean string value.
Additional this PR also fix some small issues: