Skip to content
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 10 commits into from
Sep 11, 2019
Merged

Deprecate _field_names disabling #42854

merged 10 commits into from
Sep 11, 2019

Conversation

cbuescher
Copy link
Member

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 #27239

@cbuescher cbuescher added >enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types v8.0.0 v7.2.0 v7.3.0 labels Jun 4, 2019
@elasticmachine
Copy link
Collaborator

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
Copy link
Contributor

@jtibshirani jtibshirani left a 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 the enabled 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.

@@ -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
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Member Author

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 enableoption. 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?

Copy link
Contributor

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.

Copy link
Contributor

@jimczi jimczi left a 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
Copy link
Contributor

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();
Copy link
Contributor

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 ?

@cbuescher
Copy link
Member Author

Thanks for the review, I pushed a commit addressing the nits and typos.

understanding correctly that we are planning to deprecate the option and also start ignoring it in 7.x

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.

@jimczi
Copy link
Contributor

jimczi commented Jun 5, 2019

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 _field_names to index faster) are not aware of #26930 so they continue to disable it even though their mappings don't need to index anything in the _field_names field. However I agree with Julie that it would be least surprising + most consistent to only deprecate and not ignore especially for old indices.

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 the enabled 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.

I think it's ok but if we choose to not ignore the option for old indices we should add the deprecation only if enable is set to false. This way users can remove the warning when they update their mapping to reenable the _field_names field ?

@jakelandis jakelandis removed the v7.2.0 label Jun 17, 2019
@jpountz jpountz added v7.4.0 and removed v7.3.0 labels Jul 3, 2019
@cbuescher
Copy link
Member Author

@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?

@cbuescher cbuescher changed the title Deprecate and ignore _field_names disabling Deprecate _field_names disabling Aug 5, 2019
@jtibshirani
Copy link
Contributor

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?

  • On 7.4 we emit a deprecation warning if the mapping contains an explicit setting for 'enabled' (either true or false). We will emit this deprecation warning on 7.4 no matter when the index was created (6.x or 7.x).
  • On 8.0 we disallow setting enabled on new indices. The setting continues to work for indices created in 7.x, but we still emit a deprecation warning. (Or just ignore the setting on 7.x, we can discuss this in the follow-up PR).

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 enabled: false, but I was concerned that this would encourage users to set enabled: true without reindexing. Their indices would be in a confusing in-between state where enabled: true but some documents are missing _field_names information, so exists queries will return unexpected results.

@cbuescher
Copy link
Member Author

@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.
I added information about the index that contains the "enabled" setting to make the deprecation warning more actionable.
It would be great to get the deprecation in with 7.4 but lets hear @jimczi opinion first.

@colings86 colings86 added v7.5.0 and removed v7.4.0 labels Aug 30, 2019
@cbuescher
Copy link
Member Author

@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?
I would like to merge and backport this PR and open a follow up issue for the second point (throwing error on 8.0 on new indices), if you agree.

Copy link
Contributor

@jtibshirani jtibshirani left a 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.

@cbuescher
Copy link
Member Author

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.

@cbuescher cbuescher merged commit d0a7bbc into elastic:master Sep 11, 2019
cbuescher pushed a commit that referenced this pull request Sep 11, 2019
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
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this pull request Sep 12, 2019
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.
cbuescher pushed a commit that referenced this pull request Sep 23, 2019
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
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this pull request Sep 23, 2019
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
cbuescher pushed a commit that referenced this pull request Sep 25, 2019
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
warning for templates containing this setting, which has been removed
with 8.0.

Relates to #42854, #46681
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>deprecation >enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types v7.5.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disallow disabling _field_names
7 participants