-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Deprecate _field_names
disabling
#42854
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9635484
Deprecate and ignore `_field_names` disabling
26e8b64
iter
e4620c6
Merge branch 'master' into fix-27239
d46bf47
Only deprecate and log
c2e5503
Merge branch 'master' into fix-27239
4308e8e
Log deprecation on any index version, inlcude name in log
b653c5d
iter
96ef8f8
Merge branch 'master' into fix-27239
c4a0cb0
Merge branch 'master' into fix-27239
c552702
Changes to deprecation message and revert removing test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,28 +73,26 @@ public static class Defaults { | |
} | ||
|
||
private static class Builder extends MetadataFieldMapper.Builder<Builder, FieldNamesFieldMapper> { | ||
private boolean enabled = Defaults.ENABLED; | ||
|
||
private Builder(MappedFieldType existing) { | ||
super(Defaults.NAME, existing == null ? Defaults.FIELD_TYPE : existing, Defaults.FIELD_TYPE); | ||
} | ||
|
||
private Builder enabled(boolean enabled) { | ||
this.enabled = enabled; | ||
return this; | ||
} | ||
|
||
@Override | ||
public FieldNamesFieldMapper build(BuilderContext context) { | ||
setupFieldType(context); | ||
fieldType.setHasDocValues(false); | ||
FieldNamesFieldType fieldNamesFieldType = (FieldNamesFieldType)fieldType; | ||
fieldNamesFieldType.setEnabled(enabled); | ||
fieldNamesFieldType.setEnabled(Defaults.ENABLED); | ||
return new FieldNamesFieldMapper(fieldType, context.indexSettings()); | ||
} | ||
} | ||
|
||
public static class TypeParser implements MetadataFieldMapper.TypeParser { | ||
public static final String ENABLED_DEPRECATION_MESSAGE = "Changing the `enabled` setting for `_field_names` fields is no " | ||
cbuescher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
+ "longer necassary. Disabling it has almost no benefits anymore which is why we now ignore this setting and will " | ||
+ "remove it in a future major version."; | ||
|
||
@Override | ||
public MetadataFieldMapper.Builder<?,?> parse(String name, Map<String, Object> node, | ||
ParserContext parserContext) throws MapperParsingException { | ||
|
@@ -105,7 +103,9 @@ public MetadataFieldMapper.Builder<?,?> parse(String name, Map<String, Object> n | |
String fieldName = entry.getKey(); | ||
Object fieldNode = entry.getValue(); | ||
if (fieldName.equals("enabled")) { | ||
builder.enabled(XContentMapValues.nodeBooleanValue(fieldNode, name + ".enabled")); | ||
deprecationLogger.deprecatedAndMaybeLog("field_names_enabled_parameter", ENABLED_DEPRECATION_MESSAGE); | ||
// just read the value and dump it on the floor | ||
XContentMapValues.nodeBooleanValue(fieldNode, name + ".enabled"); | ||
iterator.remove(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should still support this field (and log the deprecation) for indices created in a version where the option is available (7x) and throw an error if the version is on or after 8.0 ? |
||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could avoid mentioning
_field_names
here altogether? The same thought applies to other places in this file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, we should disallow
_field_names
entirely for newly created indices.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really following you here, #27239 talks about disabeling the
enable
option. What would disallowing the whole field mean? Do we still create the field (since its default is enabled:true?) What's the whole breaking/deprecation story around this then?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I wasn't clear I meant that we should disallow setting
_field_names
entirely since we're on master but it seems that the scope of this pr is only the deprecation. However I agree with Julie that we should try to avoid mentioning_field_names
in this test since this shouldn't affect the behavior of the percolator. If it turns too complicated we can leave this for a follow up but we'll need to do it anyway since the goal is to disallow disallowing the_field_names
entirely and this test relies on this forbidden behavior.