-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix match_only_text keyword multi-field bug #131383
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
Merged
jordan-powers
merged 8 commits into
elastic:main
from
jordan-powers:fix_match_only_text_multi_fields_3
Jul 17, 2025
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
20604d6
Add tests
jordan-powers b4625e0
Fix match_only_text for keyword multi-fields with doc values and igno…
jordan-powers 1349917
Avoid using streams api per-document
jordan-powers 21bad5c
Undo yaml test auto-format
jordan-powers 22bf17c
Merge remote-tracking branch 'upstream/main' into fix_match_only_text…
jordan-powers 434c134
Add missing ignore_above to yaml test
jordan-powers 596d3a8
Add multi-valued test
jordan-powers ea6e60f
Merge remote-tracking branch 'upstream/main' into fix_match_only_text…
jordan-powers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -435,6 +435,50 @@ synthetic_source match_only_text as multi-field: | |
- match: | ||
hits.hits.0._source.foo: "Apache Lucene powers Elasticsearch" | ||
|
||
--- | ||
synthetic_source match_only_text as multi-field with ignored keyword as parent: | ||
- requires: | ||
cluster_features: [ "mapper.source.mode_from_index_setting" ] | ||
reason: "Source mode configured through index setting" | ||
|
||
- do: | ||
indices.create: | ||
index: synthetic_source_test | ||
body: | ||
settings: | ||
index: | ||
mapping.source.mode: synthetic | ||
mappings: | ||
properties: | ||
foo: | ||
type: keyword | ||
store: false | ||
doc_values: true | ||
ignore_above: 10 | ||
fields: | ||
text: | ||
type: match_only_text | ||
|
||
- do: | ||
index: | ||
index: synthetic_source_test | ||
id: "1" | ||
refresh: true | ||
body: | ||
foo: "Apache Lucene powers Elasticsearch" | ||
|
||
- do: | ||
search: | ||
index: synthetic_source_test | ||
body: | ||
query: | ||
match_phrase: | ||
foo.text: apache lucene | ||
|
||
- match: { "hits.total.value": 1 } | ||
- match: | ||
hits.hits.0._source.foo: "Apache Lucene powers Elasticsearch" | ||
|
||
--- | ||
synthetic_source match_only_text as multi-field with stored keyword as parent: | ||
- requires: | ||
|
@@ -562,6 +606,50 @@ synthetic_source match_only_text with multi-field: | |
- match: | ||
hits.hits.0._source.foo: "Apache Lucene powers Elasticsearch" | ||
|
||
--- | ||
synthetic_source match_only_text with ignored multi-field: | ||
- requires: | ||
cluster_features: [ "mapper.source.mode_from_index_setting" ] | ||
reason: "Source mode configured through index setting" | ||
|
||
- do: | ||
indices.create: | ||
index: synthetic_source_test | ||
body: | ||
settings: | ||
index: | ||
mapping.source.mode: synthetic | ||
mappings: | ||
properties: | ||
foo: | ||
type: match_only_text | ||
fields: | ||
raw: | ||
type: keyword | ||
store: false | ||
doc_values: true | ||
ignore_above: 10 | ||
|
||
- do: | ||
index: | ||
index: synthetic_source_test | ||
id: "1" | ||
refresh: true | ||
body: | ||
foo: "Apache Lucene powers Elasticsearch" | ||
|
||
- do: | ||
search: | ||
index: synthetic_source_test | ||
body: | ||
query: | ||
match_phrase: | ||
foo: apache lucene | ||
|
||
- match: { "hits.total.value": 1 } | ||
- match: | ||
hits.hits.0._source.foo: "Apache Lucene powers Elasticsearch" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It took me a while to convince myself that there won't ever be duplicate values when some values come from doc_values and some from the original field. It might be nice to have a test that covers this case. Something like:
|
||
--- | ||
synthetic_source match_only_text with stored multi-field: | ||
- requires: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.