-
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
Conversation
Pinging @elastic/es-search |
Currently we allow `_field_names` fields to be disabled explicitely, but since the overhead is negligible now we decided to keep it turned on by default and deprecate and ignore the `enable` option on the field type. Closes elastic#27239
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.
Thanks @cbuescher, it will be very nice to remove this piece of configuration. I had a couple high-level questions:
- Am I understanding correctly that we are planning to deprecate the option and also start ignoring it in 7.x? I was wondering if we should follow the standard deprecation + removal process here, so that the configuration option will emit a deprecation warning in 7.x, but still work. I see that this PR takes the approach described in the original issue (Disallow disabling
_field_names
#27239), but to me it seems most consistent + least surprising to users to follow the normal deprecation process. - As it currently stands, I think we will log a warning on every mapping update (although it gets de-duplicated through
deprecatedAndMaybeLog
). This is because types are parsed every time we update mappings. If a user has specified theenabled
setting, it doesn't seem like they have a way of addressing the warning unless they create a fresh mapping + reindex. I wanted to check that we're okay with this behavior.
modules/percolator/src/test/java/org/elasticsearch/percolator/PercolatorFieldMapperTests.java
Outdated
Show resolved
Hide resolved
@@ -146,7 +146,7 @@ public void init() throws Exception { | |||
mapperService = indexService.mapperService(); | |||
|
|||
String mapper = Strings.toString(XContentFactory.jsonBuilder().startObject().startObject("doc") | |||
.startObject("_field_names").field("enabled", false).endObject() // makes testing easier | |||
.startObject("_field_names").endObject() // makes testing easier |
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.
server/src/main/java/org/elasticsearch/index/mapper/FieldNamesFieldMapper.java
Outdated
Show resolved
Hide resolved
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.
Thanks @cbuescher . I left some additional comments.
@@ -146,7 +146,7 @@ public void init() throws Exception { | |||
mapperService = indexService.mapperService(); | |||
|
|||
String mapper = Strings.toString(XContentFactory.jsonBuilder().startObject().startObject("doc") | |||
.startObject("_field_names").field("enabled", false).endObject() // makes testing easier | |||
.startObject("_field_names").endObject() // makes testing easier |
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.
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 comment
The 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 ?
Thanks for the review, I pushed a commit addressing the nits and typos.
I was wondering the same but since this PR is against 8.0 I was hoping we can discuss this here. Seeing that the scope of the issue now seems to shift slightly I think we should map out the real goals of #27239 before I proceed. |
I think that most of the user of this feature (disallowing
I think it's ok but if we choose to not ignore the option for old indices we should add the deprecation only if |
@jtibshirani @jimczi picking this up again, I reduced the scope of this PR to only add deprecation logging with the intent to backport this to 7.4 so we already have deprecation in 7 and then follow up in a separate PR to either completely disallow it (throwing an error) in 8 (only on newly created indices, the ones created in 7 should continue working) or just changing to a no-op in 8 and complete removal in a later version. Since this might also require some additons to the upgrade assistant I'd like to get deprecation in now and work on ignoring or removing the option entirely in a follow up PR. Wdyt? |
_field_names
disabling_field_names
disabling
It sounds good to me to focus only on deprecation for this PR. To make sure we're on the same page before jumping into the code, what do you both think of this high-level plan?
To me this seems like the most straightforward + least surprising plan. But it is a little annoying to see a deprecation warning every time the mapping is parsed, without an easy way to fix it without creating a fresh mapping + reindexing. @jimczi suggested that we could only log a warning if |
@jtibshirani I'm in favour of the plan you proposed. I changed the PR slightly so that in its current form we emit a deprecation warning if the mapping contains an explicit setting for 'enabled' regardless of the value and the index version. I'm not too concerned with too many deprecation warnings. As far as I understand, warnings should be emitted on index creation, index opening or mapping updates (which might happen when new fields are added either via explicit mapping updates or indexing new documents with new fields). All those cases should be limited to a few times, the warnings in the request header that are always there can be ignored by the client and the warnings in the log should largely be de-duplicated. |
@jtibshirani @jimczi just fixed some conflicts on this PR, looks like FF for 7.4 already passed so I think the deprecation logging can be added for 7.5 next. Could you take another look and let me know if this reflects Julies previous suggestion? |
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.
This looks good to me as the initial deprecation PR.
server/src/test/java/org/elasticsearch/index/mapper/FieldNamesFieldMapperTests.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/mapper/FieldNamesFieldMapper.java
Outdated
Show resolved
Hide resolved
Thanks @jtibshirani, also checked with @jimczi on another channel who approves the plan as well. Will merge then and follow up with another PR on master to disallow the setting on new indices. |
Currently we allow `_field_names` fields to be disabled explicitely, but since the overhead is negligible now we decided to keep it turned on by default and deprecate the `enable` option on the field type. This change adds a deprecation warning whenever this setting is used, going forward we want to ignore and finally remove it. Closes #27239
After deprecating the setting starting with 7.5 in elastic#42854, this change disallows setting enabled for the `_field_names` field on new indices. The setting continues to work for indices created in 7.x where we still emit a deprecation warning.
After deprecating the `enabled` setting for `_field_names`starting with 7.5, this change disallows the setting on new indices in 8.0. The setting continues to work for indices created in 7.x where we continue emitting a deprecation warning. Relates to #42854
This change adds a check to the migration tool that warns about the deprecated "enabled" setting for the "_field_names" field on 7.x indices and issues a critical error for templates containing this setting, since it has been removed with 8.0. Relates to elastic#42854, elastic#46681
Currently we allow
_field_names
fields to be disabled explicitely, but sincethe overhead is negligible now we decided to keep it turned on by default and
deprecate and ignore the
enable
option on the field type.Closes #27239