Skip to content

Conversation

@jtibshirani
Copy link
Contributor

@jtibshirani jtibshirani commented Oct 6, 2020

When constructing a value fetcher, the 'parsesArrayValue' flag must match
FieldMapper#parsesArrayValue. However there is nothing in code or tests to
help enforce this.

This PR splits out a class ArraySourceValueFetcher that handles array values
directly and removes the flag. That way most field types can use the default
SourceValueFetcher. Field types that handle array values opt to use
ArraySourceValueFetcher and ensure the behavior is covered by tests.

Follow-up to #62974.

When constructing a value fetcher, the 'parsesArrayValue' flag must match
`FieldMapper#parsesArrayValue`. However there is nothing in code or tests to
help enforce this.

This PR reworks the value fetcher constructors so that `parsesArrayValue` is
'false' by default. Just as for `FieldMapper#parsesArrayValue`, field types must
explicitly set it to true and ensure the behavior is covered by tests.

Follow-up to elastic#62974.
@jtibshirani jtibshirani added :Search/Search Search-related issues that do not fall into other categories >refactoring v7.10.0 v8.0.0 labels Oct 6, 2020
@elasticmachine
Copy link
Collaborator

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

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Oct 6, 2020
Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

Makes sense to me! I'll let @romseygeek review because it sounds like he understands the problem better.

Copy link
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

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

LGTM, much nicer. Thanks @jtibshirani!

@jtibshirani jtibshirani merged commit cc09b6b into elastic:master Oct 6, 2020
@jtibshirani jtibshirani deleted the fields-array-values branch October 6, 2020 21:42
@jtibshirani
Copy link
Contributor Author

Thank you both for the reviews !

jtibshirani added a commit to jtibshirani/elasticsearch that referenced this pull request Oct 6, 2020
When constructing a value fetcher, the 'parsesArrayValue' flag must match
`FieldMapper#parsesArrayValue`. However there is nothing in code or tests to
help enforce this.

This PR reworks the value fetcher constructors so that `parsesArrayValue` is
'false' by default. Just as for `FieldMapper#parsesArrayValue`, field types must
explicitly set it to true and ensure the behavior is covered by tests.

Follow-up to elastic#62974.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>refactoring :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v7.10.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants