Fix match_only_text keyword multi-field bug#131383
Merged
jordan-powers merged 8 commits intoelastic:mainfrom Jul 17, 2025
Merged
Fix match_only_text keyword multi-field bug#131383jordan-powers merged 8 commits intoelastic:mainfrom
jordan-powers merged 8 commits intoelastic:mainfrom
Conversation
Collaborator
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
jordan-powers
commented
Jul 16, 2025
...per-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java
Show resolved
Hide resolved
| - match: { "hits.total.value": 1 } | ||
| - match: | ||
| hits.hits.0._source.foo: "Apache Lucene powers Elasticsearch" | ||
|
|
Contributor
There was a problem hiding this comment.
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 as multi-field with ignored stored keyword as parent with multiple values:
- 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", "Apache"]
- 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", "Apache Lucene powers Elasticsearch"]
parkertimmins
approved these changes
Jul 16, 2025
Contributor
parkertimmins
left a comment
There was a problem hiding this comment.
I had one test suggestion, but looks good. Nice work!
16a8e7f to
ea6e60f
Compare
kkrik-es
approved these changes
Jul 17, 2025
jordan-powers
added a commit
to jordan-powers/elasticsearch
that referenced
this pull request
Jul 17, 2025
In elastic#131314 we fixed match_only_text fields with ignore_above keyword multi-fields in the case that the keyword multi-field is stored. However, the issue is still present if the keyword field is not stored, but instead has doc values. This patch fixes that case.
This was referenced Jul 17, 2025
Collaborator
jordan-powers
added a commit
to jordan-powers/elasticsearch
that referenced
this pull request
Jul 17, 2025
In elastic#131314 we fixed match_only_text fields with ignore_above keyword multi-fields in the case that the keyword multi-field is stored. However, the issue is still present if the keyword field is not stored, but instead has doc values. This patch fixes that case.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Jul 17, 2025
In #131314 we fixed match_only_text fields with ignore_above keyword multi-fields in the case that the keyword multi-field is stored. However, the issue is still present if the keyword field is not stored, but instead has doc values. This patch fixes that case.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Jul 17, 2025
In #131314 we fixed match_only_text fields with ignore_above keyword multi-fields in the case that the keyword multi-field is stored. However, the issue is still present if the keyword field is not stored, but instead has doc values. This patch fixes that case.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In #131314 we fixed match_only_text fields with ignore_above keyword multi-fields in the case that the keyword multi-field is stored. However, the issue is still present if the keyword field is not stored, but instead has doc values.
This patch fixes that case.
Follow-up to #131314.