-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Data Management/ILM+SLMIndex and Snapshot lifecycle managementIndex and Snapshot lifecycle management>regressionTeam:Data ManagementMeta label for data/management teamMeta label for data/management teamv7.9.0v8.0.0-alpha1
Description
Elasticsearch version (bin/elasticsearch --version): 7.6
Plugins installed: []
Description of the problem including expected versus actual behavior:
Rollover API takes index settings as input parameters. The settings can specified as one of the below options:
1. "settings": {
"index" : {
"number_of_shards": 2
}
}
2. "settings": {
"index.number_of_shards": 2
}
3. "settings": {
"number_of_shards": 2
}
But, with this PR. the #3 option doesn't work and throws error as
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "unknown setting [number_of_shards] did you mean [index.number_of_shards]?"
}
],
"type" : "illegal_argument_exception",
"reason" : "unknown setting [number_of_shards] did you mean [index.number_of_shards]?"
},
"status" : 400
}
Fix:
There is normalize and settings validation logic in onlyCreateIndex method and after refactoring this code is not getting triggered during rollover flow which calls applyCreateIndexRequest method.
Settings.Builder updatedSettingsBuilder = Settings.builder();
Settings build = updatedSettingsBuilder.put(request.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build();
indexScopedSettings.validate(build, true); // we do validate here - index setting must be consistent
request.settings(build);
The normalize call should also run during rollover flow otherwise it breaks the expected behavior.
Steps to reproduce:
1. curl -XPUT localhost:9200/abc-000001
2. curl -XPUT localhost:9200/abc-000001/_alias/abc
3. curl -X POST "localhost:9200/abc/_rollover?pretty" -H 'Content-Type: application/json' -d'
{
"conditions": {
"max_age": "1s"
},
"settings": {
"number_of_shards": 2
}
}
'
Tried running this in 7.5 with no issue and rollover works as expected.
Metadata
Metadata
Assignees
Labels
:Data Management/ILM+SLMIndex and Snapshot lifecycle managementIndex and Snapshot lifecycle management>regressionTeam:Data ManagementMeta label for data/management teamMeta label for data/management teamv7.9.0v8.0.0-alpha1