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

Wildcard field fix for scripts - changed value type from BytesRef to String #58060

Merged
merged 1 commit into from Jun 15, 2020

Conversation

markharwood
Copy link
Contributor

@markharwood markharwood commented Jun 12, 2020

Scripts accessing wildcard fields currently get ByteRefs instead of Strings which would be more useful and compatible with keyword fields. This PR addresses that.

We have existing tests that check that binary fields return ByteRefs so we have to preserve that behaviour for non-wildcard fields.

Existing BytesBinaryDVLeafFieldData assumes ByteRefs are required in scripts so I pulled most of its existing logic up into a common abstract class and created a new subclass with the required override to provide String-based return type. All other changes stem from that refactoring.
I wasn't too comfortable about the naming of new classes - "StringBinaryDV" seems like a contradiction but "WildcardBinaryDv" seems clumsy too (saying more about how we want to search than the data type).

Closes #58044

@markharwood markharwood added >bug :Search/Mapping Index mappings, including merging and defining field types labels Jun 12, 2020
@markharwood markharwood self-assigned this Jun 12, 2020
@elasticmachine
Copy link
Collaborator

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

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Jun 12, 2020
@markharwood markharwood force-pushed the fix/58044 branch 3 times, most recently from c55adb7 to b1450e5 Compare June 15, 2020 10:14
This need some reorg of BinaryDV field data classes to allow specialisation of scripted doc values.
Moved common logic to a new abstract base class and added a new subclass to return string-based representations to scripts.

Closes elastic#58044
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.

LGTM

@markharwood markharwood merged commit 33fe44c into elastic:master Jun 15, 2020
markharwood added a commit to markharwood/elasticsearch that referenced this pull request Jun 15, 2020
elastic#58060)

This need some reorg of BinaryDV field data classes to allow specialisation of scripted doc values.
Moved common logic to a new abstract base class and added a new subclass to return string-based representations to scripts.

Closes elastic#58044
markharwood added a commit that referenced this pull request Jun 15, 2020
#58060) (#58109)

This need some reorg of BinaryDV field data classes to allow specialisation of scripted doc values.
Moved common logic to a new abstract base class and added a new subclass to return string-based representations to scripts.

Closes #58044
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team v7.9.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wildcard field should return value as Strings not ByteRefs for scripts
4 participants