Fix default value for some settings when filtered#137652
Fix default value for some settings when filtered#137652jordan-powers merged 13 commits intoelastic:mainfrom
Conversation
|
Hi @jordan-powers, I've created a changelog YAML for you. |
…beyond-limit-default-value
|
Hi @jordan-powers, I've updated the changelog YAML for you. |
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
|
Thanks @jordan-powers! |
|
Hi @jordan-powers, I've updated the changelog YAML for you. |
…beyond-limit-default-value
mosche
left a comment
There was a problem hiding this comment.
Thanks again for the fix!
I just pointed out some minor nits on the new test case, looking good otherwise :)
| public void testGetDefaultValueWhenDependentOnOtherSettings() { | ||
| final String indexName = "test-index-1"; | ||
|
|
||
| String[][] expectedSettings = { |
There was a problem hiding this comment.
Thanks for adding the test!
Though, a nit on that. Could you assert that the filtered response contains nothing else than the filtered key.
That should be fairly easy if making expectedSettings a Settings object. That way lists are also properly supported.
Settings expectedSettings = Settings.builder()
.put("index.mapping.source.mode", "SYNTHETIC")
...
.build();
...
for (String key : expectedSettings.keySet()) {
...
Map<String, Settings> expectedResponse = Map.of(indexName, expectedSettings.filter(key::equals));
assertThat(
filteredResponse,
Matchers.either(LambdaMatchers.transformedMatch(GetSettingsResponse::getIndexToSettings, equalTo(expectedResponse)))
.or(LambdaMatchers.transformedMatch(GetSettingsResponse::getIndexToDefaultSettings, equalTo(expectedResponse)))
);
}There was a problem hiding this comment.
I'm also wondering how stable these settings will be for index modelogsdb.
If there are settings that are more likely to change, we should better not check them here as that would lead to a rather unexpected place for test failures.
There was a problem hiding this comment.
I believe these settings should be fairly stable, so it'd be ok to check them here.
|
|
||
| assertAcked(prepareCreate(indexName).setSettings(Settings.builder().put("index.mode", "logsdb")).get()); | ||
| for (String[] expectedSetting : expectedSettings) { | ||
| GetSettingsResponse unfilteredResponse = indicesAdmin().getSettings( |
There was a problem hiding this comment.
nit, this could move out of the loop
…beyond-limit-default-value
…beyond-limit-default-value
…beyond-limit-default-value
Some settings (such as index.mapping.total_fields. ignore_dynamic_beyond_limit) rely on the value of other settings to determine their default value. When retrieving a setting value or default, the api allows the user to specify a filter, and the returned settings object will be filtered to only include the relevant setting. However, we are currently applying this filter to the settings object that we pass to the defaults providers. This means that the other setting(s) which determines the default value for the dependent setting might be hidden by the filter, and so an incorrect default will be returned. This PR fixes that logic so that the unfiltered set of all set settings is passed into the default values provider.
Some settings (such as index.mapping.total_fields. ignore_dynamic_beyond_limit) rely on the value of other settings to determine their default value. When retrieving a setting value or default, the api allows the user to specify a filter, and the returned settings object will be filtered to only include the relevant setting. However, we are currently applying this filter to the settings object that we pass to the defaults providers. This means that the other setting(s) which determines the default value for the dependent setting might be hidden by the filter, and so an incorrect default will be returned. This PR fixes that logic so that the unfiltered set of all set settings is passed into the default values provider.
…138195) * Fix default value for some settings when filtered (#137652) Some settings (such as index.mapping.total_fields. ignore_dynamic_beyond_limit) rely on the value of other settings to determine their default value. When retrieving a setting value or default, the api allows the user to specify a filter, and the returned settings object will be filtered to only include the relevant setting. However, we are currently applying this filter to the settings object that we pass to the defaults providers. This means that the other setting(s) which determines the default value for the dependent setting might be hidden by the filter, and so an incorrect default will be returned. This PR fixes that logic so that the unfiltered set of all set settings is passed into the default values provider. * Fix test compile error * Remove settings that haven't been backported from test
…38196) * Fix default value for some settings when filtered (#137652) Some settings (such as index.mapping.total_fields. ignore_dynamic_beyond_limit) rely on the value of other settings to determine their default value. When retrieving a setting value or default, the api allows the user to specify a filter, and the returned settings object will be filtered to only include the relevant setting. However, we are currently applying this filter to the settings object that we pass to the defaults providers. This means that the other setting(s) which determines the default value for the dependent setting might be hidden by the filter, and so an incorrect default will be returned. This PR fixes that logic so that the unfiltered set of all set settings is passed into the default values provider. * Remove settings that haven't been backported from test
…38194) * Fix default value for some settings when filtered (#137652) Some settings (such as index.mapping.total_fields. ignore_dynamic_beyond_limit) rely on the value of other settings to determine their default value. When retrieving a setting value or default, the api allows the user to specify a filter, and the returned settings object will be filtered to only include the relevant setting. However, we are currently applying this filter to the settings object that we pass to the defaults providers. This means that the other setting(s) which determines the default value for the dependent setting might be hidden by the filter, and so an incorrect default will be returned. This PR fixes that logic so that the unfiltered set of all set settings is passed into the default values provider. * Remove settings that haven't been backported from test
Some settings (such as
index.mapping.total_fields.ignore_dynamic_beyond_limit) rely on the value of other settings to determine their default value.When retrieving a setting value or default, the api allows the user to specify a filter, and the returned settings object will be filtered to only include the relevant setting.
However, we are currently applying this filter to the settings object that we pass to the defaults providers. This means that the other setting(s) which determines the default value for the dependent setting might be hidden by the filter, and so an incorrect default will be returned.
This PR fixes that logic so that the unfiltered set of all set settings is passed into the default values provider.
Fixes #136333