-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix BWC in match_only_text #130020
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
Fix BWC in match_only_text #130020
Conversation
|
Hi @jordan-powers, I've created a changelog YAML for you. |
87260f6 to
33d2e3a
Compare
|
Hi @jordan-powers, I've created a changelog YAML for you. |
6c0aacf to
a382ba6
Compare
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
0daf1c7 to
1d285b1
Compare
martijnvg
left a comment
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 left minor comments. These can be fixed in follow up
| if (stored instanceof BytesRef) { | ||
| return (BytesRef) stored; | ||
| } else { | ||
| return new BytesRef((String) stored); |
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.
| return new BytesRef((String) stored); | |
| assert stored instances String | |
| return new BytesRef(stored.toString()); |
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.
nit: maybe use BytesRefs#toBytesRef
| if (stored instanceof BytesRef) { | ||
| return (BytesRef) stored; |
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.
| if (stored instanceof BytesRef) { | |
| return (BytesRef) stored; | |
| if (stored instanceof BytesRef storedBytes) { | |
| return storedBytes; |
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.
nit: Maybe use BytesRefs#toString
| @Override | ||
| protected void write(XContentBuilder b, Object value) throws IOException { | ||
| b.value(((BytesRef) value).utf8ToString()); | ||
| if (value instanceof BytesRef) { |
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.
Same here?
| } | ||
| } | ||
|
|
||
| public static class BytesFromMixedStringsBytesRefBlockLoader extends StoredFieldsBlockLoader { |
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.
If this can be moved to mapper-extras module then we can make this package protected and control its usage. Given that normally this class shouldn't be used. It just now a workaround for a bwc bug.
dnhatn
left a comment
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.
LGTM. Thanks Jordan!
|
2 checks are failing: |
99ee7ab
into
elastic:patch/serverless-fix
This brings in the fixes from #130020, with minor fixes to address review nits from that PR. Co-authored-by: Martijn van Groningen <[email protected]>
This brings in the fixes from elastic#130020, with minor fixes to address review nits from that PR. Co-authored-by: Martijn van Groningen <[email protected]>
* Pull match_only_text fixes into main (#130049) This brings in the fixes from #130020, with minor fixes to address review nits from that PR. Co-authored-by: Martijn van Groningen <[email protected]> (cherry picked from commit 40a7d02) # Conflicts: # qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java * Fix base class of MatchOnlyTextRollingUpgradeIT * Add missing assumption to MatchOnlyTextRollingUpgradeIT
This brings in the fixes from elastic#130020, with minor fixes to address review nits from that PR. Co-authored-by: Martijn van Groningen <[email protected]>
This brings in the fixes from #130020, with minor fixes to address review nits from that PR. Co-authored-by: Martijn van Groningen <[email protected]>
This brings in the fixes from elastic#130020, with minor fixes to address review nits from that PR. Co-authored-by: Martijn van Groningen <[email protected]>
This patch updates places that expect the match_only_text stored field to be stored as a BytesRef to instead perform an instanceof check and see if it's a string or BytesRef.