Skip to content

Conversation

@martijnvg
Copy link
Member

@martijnvg martijnvg commented Jun 27, 2025

Bugs starting to occur when #129126 was merged.

Closes #129737

This is a bug, but marking as non-issue. Given that it has not been released in a stateful release.

@martijnvg martijnvg added >non-issue :StorageEngine/Mapping The storage related side of mappings v8.19.0 auto-backport Automatically create backport pull requests when merged labels Jun 27, 2025
@martijnvg martijnvg marked this pull request as ready for review June 27, 2025 15:00
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@parkertimmins parkertimmins self-requested a review June 27, 2025 15:40
if (searchExecutionContext.isSourceSynthetic()) {
if (searchExecutionContext.isSourceSynthetic() && withinMultiField == false && hasCompatibleMultiFields == false) {
String name = storedFieldNameForSyntheticSource();
// TODO: go the parent field and load either via stored fields or doc values the values instead synthesizing complete source
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// TODO: go the parent field and load either via stored fields or doc values the values instead synthesizing complete source
// TODO: go the parent field and load either via stored fields or doc values, instead of synthesizing the complete source.

if (searchExecutionContext.isSourceSynthetic() && withinMultiField == false && hasCompatibleMultiFields == false) {
String name = storedFieldNameForSyntheticSource();
// TODO: go the parent field and load either via stored fields or doc values the values instead synthesizing complete source
// (in case of synthetic source and if this field is a multi field, then it will not have a stored field.)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// (in case of synthetic source and if this field is a multi field, then it will not have a stored field.)
// In case of synthetic source and if this field is a multi field, then it will not have a stored field.

);
}
if (searchExecutionContext.isSourceSynthetic()) {
if (searchExecutionContext.isSourceSynthetic() && withinMultiField == false && hasCompatibleMultiFields == false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: these two variables are only used here? If so, replace them with one?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is actually for the follow up. When there is a keyword multi field then doc values or stored field of the multi field is used, otherwise if stored field / doc values of parent keyword field is used.

if (searchExecutionContext.isSourceSynthetic()) {
if (searchExecutionContext.isSourceSynthetic() && withinMultiField == false && hasCompatibleMultiFields == false) {
String name = storedFieldNameForSyntheticSource();
// TODO: go the parent field and load either via stored fields or doc values the values instead synthesizing complete source
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this comment belong to the next block that invokes SourceProvider?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the values would be loaded via source provider, which is slow. I will fix this.

}
);
} else {
var kwd = TextFieldMapper.SyntheticSourceHelper.getKeywordFieldMapperForSyntheticSource(this);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is keyword the only multifield combination with match_only_text?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, in other cases the match_only_text field will be stored.

Copy link
Contributor

@kkrik-es kkrik-es left a comment

Choose a reason for hiding this comment

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

A few comments, but approving to get you going.

@martijnvg martijnvg enabled auto-merge (squash) June 30, 2025 06:02
@martijnvg martijnvg merged commit 15c0028 into elastic:main Jun 30, 2025
32 checks passed
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Jun 30, 2025
* Fix match_only_text bugs if defined as multi-field

Bugs starting to occur when elastic#129126 was merged.

Closes elastic#129737
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.19 Commit could not be cherrypicked due to conflicts
9.1

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 130188

elasticsearchmachine pushed a commit that referenced this pull request Jun 30, 2025
* Fix match_only_text bugs if defined as multi-field

Bugs starting to occur when #129126 was merged.

Closes #129737
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Jun 30, 2025
Backporting elastic#130188 to 8.19 branch.

Bugs starting to occur when elastic#129126 was merged.

Closes elastic#129737
elasticsearchmachine pushed a commit that referenced this pull request Jun 30, 2025
Backporting #130188 to 8.19 branch.

Bugs starting to occur when #129126 was merged.

Closes #129737
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jul 3, 2025
* Fix match_only_text bugs if defined as multi-field

Bugs starting to occur when elastic#129126 was merged.

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

Labels

auto-backport Automatically create backport pull requests when merged >non-issue :StorageEngine/Mapping The storage related side of mappings Team:StorageEngine v8.19.0 v9.1.0 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NPE in SourceConfirmedTextQuery

3 participants