-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Use FallbackSyntheticSourceBlockLoader for text fields #126237
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
Conversation
| // See TextFieldMapper.SyntheticSourceHelper#usingSyntheticSourceDelegate | ||
| // and TextFieldMapper#canUseSyntheticSourceDelegateForLoading(). | ||
| boolean usingSyntheticSourceDelegate = docValues || store; | ||
| boolean canUseSyntheticSourceDelegateForLoading = usingSyntheticSourceDelegate && ignoreAbove == null && (index || store); |
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 don't really understand why do we require multi field to be indexed here (the actual impl is in TextFieldMapper).
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.
Yes, that is strange (only doc values / stored should matter). What failure occurs when we don't check for index here?
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 think you'll get different results sometimes, i can't remember now.
| return KeywordFieldBlockLoaderTests.expectedValue(keywordMultiFieldMapping, value, params, testContext); | ||
| } | ||
|
|
||
| // Even if multi-field is not eligible for loading it can still be used to produce synthetic source |
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.
This whole thing is due to the fact that not all syntheticSourceDelegate are eligible to be used by block loader.
| // KeywordFieldBlockLoaderTest | ||
| // It is here since KeywordFieldBlockLoaderTest does not really need it | ||
| if (params.syntheticSource() && testContext.forceFallbackSyntheticSource() == false && usingSyntheticSourceDelegate) { | ||
| var nullValue = (String) keywordMultiFieldMapping.get("null_value"); |
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 syntheticSourceDelegate is used than null_value of the multi field will be in the resulting synthetic source. This is good because we'll preserve such values during reindex. On the other hand this is inconsistent - synthetic source for text behaves differently depending on the presence of multi field and mapping parameters of multi field (text ignores nulls).
| if (params.syntheticSource() && testContext.forceFallbackSyntheticSource() == false && usingSyntheticSourceDelegate) { | ||
| var nullValue = (String) keywordMultiFieldMapping.get("null_value"); | ||
|
|
||
| // Due to how TextFieldMapper#blockReaderDisiLookup works this is complicated. |
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.
Another inconsistency - block loader returns a null_value from multi field instead of null only if text field itself is not indexed. If it is, it returns nothing.
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
|
Hi @lkts, I've created a changelog YAML for you. |
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 Sasha!
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.
LGTM 👍
| // See TextFieldMapper.SyntheticSourceHelper#usingSyntheticSourceDelegate | ||
| // and TextFieldMapper#canUseSyntheticSourceDelegateForLoading(). | ||
| boolean usingSyntheticSourceDelegate = docValues || store; | ||
| boolean canUseSyntheticSourceDelegateForLoading = usingSyntheticSourceDelegate && ignoreAbove == null && (index || store); |
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.
Yes, that is strange (only doc values / stored should matter). What failure occurs when we don't check for index here?
💔 Backport failed
You can use sqren/backport to manually backport by running |
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
This also covers
annotated_textbecauseAnnotatedTextFieldTypeinheritsTextFieldType.