Skip to content

[Rest Api Compatibility] Ignore use_field_mapping option for docvalue #74435

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

Merged
merged 4 commits into from
Jun 24, 2021

Conversation

pgomulka
Copy link
Contributor

previously removed in #55622 use_field_mapping option can be used on doc
value format under rest api compatibility.
The value itself is ignored (replaced with null) as it is a default
behaviour to use field mapping format.

  • Have you signed the contributor license agreement?
  • Have you followed the contributor guidelines?
  • If submitting code, have you built your formula locally prior to submission with gradle check?
  • If submitting code, is your pull request against master? Unless there is a good reason otherwise, we prefer pull requests against master and will backport as needed.
  • If submitting code, have you checked that your submission is for an OS and architecture that we support?
  • If you are submitting this code for a class then read our policy for that.

previously removed in elastic#55622 use_field_mapping option can be used on doc
value format under rest api compatibility.
The value itself is ignored (replaced with null) as it is a default
behaviour to use field mapping format.
@pgomulka pgomulka added :Search/Search Search-related issues that do not fall into other categories :Core/Infra/REST API REST infrastructure and utilities v8.0.0 labels Jun 22, 2021
@pgomulka pgomulka self-assigned this Jun 22, 2021
@elasticmachine elasticmachine added Team:Search Meta label for search team Team:Core/Infra Meta label for core/infra team labels Jun 22, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@pgomulka pgomulka requested review from jtibshirani and jimczi June 22, 2021 14:22
@@ -104,7 +104,6 @@ tasks.named("yamlRestCompatTest").configure {
'mtermvectors/11_basic_with_types/Basic tests for multi termvector get',
'mtermvectors/21_deprecated_with_types/Deprecated camel case and _ parameters should fail in Term Vectors query',
'mtermvectors/30_mix_typeless_typeful/mtermvectors without types on an index that has types',
'search/10_source_filtering/docvalue_fields with default format', //use_field_mapping change
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the 7.x test asserts about the deprecation warning and the right format (declared on mapping) being used

return null;
} else {
String text = p.text();
if (text.equals("use_field_mapping")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, could use USE_DEFAULT_FORMAT constant here.

/**
* Wrapper around a field name and the format that should be used to
* display values of this field.
*/
public final class FieldAndFormat implements Writeable, ToXContentObject {
private static final String USE_DEFAULT_FORMAT = "use_field_mapping";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is also used by the fields option, in addition to docvalue_fields, which means we're allowing use_field_mapping to be set on 7.x on the fields option, even though it was never allowed before. This is unfortunate, but seems like an okay compromise to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, I was not aware of this.. I don't think the parser has the information about the parent of the current key/value..
The only alternative would be to use two different parsers, but I am not sure if this is not an overdo.
Especially because this is meant to be for rest backwards compatibility. It would be surprising to see someone start using "use_field_mapping" with rest api compatibility for the fields when it was not allowed in 7.x..
Also it would not do anything anyway.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also feel like this is the right trade-off to keep the code simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/REST API REST infrastructure and utilities >enhancement :Search/Search Search-related issues that do not fall into other categories Team:Core/Infra Meta label for core/infra team Team:Search Meta label for search team v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants