Skip to content

Conversation

Kubik42
Copy link
Contributor

@Kubik42 Kubik42 commented Sep 11, 2025

This addresses #134097.

This PR:

  • fixes block loader in MatchOnlyTextFieldMapper to now correctly delegate to a keyword multi field, if one is present
  • adds additional test coverage around block loaders for match only text
  • adjusts MatchOnlyTextRollingUpgradeIT to be similar to TextRollingUpgradeIT. This means, the correct template is now used for the test + other quality of life improvements

Due to the nature of this bug fix, the BWC test MatchOnlyTextRollingUpgradeIT will start to fail if this PR is merged. This is because this bug is still present in 8.19 and 9.1. To overcome that, I've preemptively muted the test. Once this change is merged and backported into 8.19 and 9.1, I'll open another PR that unmutes the test and backport that.

@Kubik42 Kubik42 added >bug Team:StorageEngine :StorageEngine/Mapping The storage related side of mappings labels Sep 11, 2025
@Kubik42 Kubik42 changed the title Fixed match only text block loader not working when a keyword multi f… Fixed match only text block loader not working when a keyword multi field is present Sep 11, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @Kubik42, I've created a changelog YAML for you.

@Kubik42 Kubik42 added auto-backport Automatically create backport pull requests when merged v8.19.5 v9.1.5 labels Sep 12, 2025
@Kubik42
Copy link
Contributor Author

Kubik42 commented Sep 12, 2025

Upon diving a bit deeper, I found that this BWC works differently for different release versions. More specifically:

This explains why 8.18 / 9.0 -> 9.2 BWC tests pass while 8.19 / 9.1 -> 9.2 fail.

I've also checked what release versions we test against and they're as follows:

  • 9.2 -> 9.1, 9.0, 8.19, 8.18
  • 9.1 -> 9.0, 8.19, 8.18
  • 9.0 -> 8.18
  • 8.19 -> 8.18, 7.17
  • 8.18 -> 7.17

From above, 9.0 and 8.18 don't need a backport and will work. 9.1 and 8.19 will receive a backport as I've described. This just leaves 7.17, which doesn't even support synthetic source or have block loaders, so it should pass as well.

What this ultimately means is that we don't need a version gate anywhere in this test. All we need to do is backport the fix to 9.1 and 8.19.

muted-tests.yml Outdated
method: test {csv-spec:fork.FiveFork}
issue: https://github.com/elastic/elasticsearch/issues/134560
- class: org.elasticsearch.upgrades.MatchOnlyTextRollingUpgradeIT
issue: https://github.com/elastic/elasticsearch/issues/134097
Copy link
Contributor Author

@Kubik42 Kubik42 Sep 13, 2025

Choose a reason for hiding this comment

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

Preemptively muting this test as it'll fail until the backport is completed. I've ran this test locally and it passes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Normally we don't manually mute tests.

I think the way this is normally addressed, you'd add a cluster feature representing this change (or use the built-in cluster features representing release versions), then add an assumeTrue gating the test on the presence of that feature.

assumeTrue("requires storing leaf array offsets", oldClusterHasFeature("gte_v9.1.0"));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

even if this is temporary? My idea was to mute this test now, backport the fix, and then unmute the test. Without that, the test will fail against previous versions.

Copy link
Member

Choose a reason for hiding this comment

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

The convention is to use a node feature for this. Tests are muted for genuine test failures.

So let's add a node feature for this (in MapperFeatures#getTestFeatures(...)). The upside it is that the test can be back ported without having think about older versions not having this change (e.g. when changes to MatchOnlyTextRollingUpgradeIT in this PR land in 8.19 branch).

@Kubik42 Kubik42 marked this pull request as ready for review September 15, 2025 18:56
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Contributor

@jordan-powers jordan-powers left a comment

Choose a reason for hiding this comment

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

I had a few comments, but the overall direction looks good

muted-tests.yml Outdated
method: test {csv-spec:fork.FiveFork}
issue: https://github.com/elastic/elasticsearch/issues/134560
- class: org.elasticsearch.upgrades.MatchOnlyTextRollingUpgradeIT
issue: https://github.com/elastic/elasticsearch/issues/134097
Copy link
Contributor

Choose a reason for hiding this comment

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

Normally we don't manually mute tests.

I think the way this is normally addressed, you'd add a cluster feature representing this change (or use the built-in cluster features representing release versions), then add an assumeTrue gating the test on the presence of that feature.

assumeTrue("requires storing leaf array offsets", oldClusterHasFeature("gte_v9.1.0"));

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

One comment around muted tests and node features, LGTM otherwise

muted-tests.yml Outdated
method: test {csv-spec:fork.FiveFork}
issue: https://github.com/elastic/elasticsearch/issues/134560
- class: org.elasticsearch.upgrades.MatchOnlyTextRollingUpgradeIT
issue: https://github.com/elastic/elasticsearch/issues/134097
Copy link
Member

Choose a reason for hiding this comment

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

The convention is to use a node feature for this. Tests are muted for genuine test failures.

So let's add a node feature for this (in MapperFeatures#getTestFeatures(...)). The upside it is that the test can be back ported without having think about older versions not having this change (e.g. when changes to MatchOnlyTextRollingUpgradeIT in this PR land in 8.19 branch).

@Kubik42 Kubik42 merged commit 86227fb into elastic:main Sep 18, 2025
34 checks passed
@Kubik42 Kubik42 deleted the 134097 branch September 18, 2025 03:18
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

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

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

gmjehovich pushed a commit to gmjehovich/elasticsearch that referenced this pull request Sep 18, 2025
…ield is present (elastic#134582)

* Fixed match only text block loader not working when a keyword multi field is present

* Update docs/changelog/134582.yaml

* Preemptively mute this test

* [CI] Auto commit changes from spotless

* Addressed feedback

* Update modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldTypeTests.java

Co-authored-by: Jordan Powers <[email protected]>

* Preemptively mute this test

* Fixed copyright

* Gate tests on feature presence

* [CI] Auto commit changes from spotless

* Revert muted-tests to main

---------

Co-authored-by: elasticsearchmachine <[email protected]>
Co-authored-by: Jordan Powers <[email protected]>
Kubik42 added a commit to Kubik42/elasticsearch that referenced this pull request Sep 18, 2025
…ield is present (elastic#134582)

* Fixed match only text block loader not working when a keyword multi field is present

* Update docs/changelog/134582.yaml

* Preemptively mute this test

* [CI] Auto commit changes from spotless

* Addressed feedback

* Update modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldTypeTests.java

Co-authored-by: Jordan Powers <[email protected]>

* Preemptively mute this test

* Fixed copyright

* Gate tests on feature presence

* [CI] Auto commit changes from spotless

* Revert muted-tests to main

---------

Co-authored-by: elasticsearchmachine <[email protected]>
Co-authored-by: Jordan Powers <[email protected]>
(cherry picked from commit 86227fb)

# Conflicts:
#	server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java
Kubik42 added a commit to Kubik42/elasticsearch that referenced this pull request Sep 18, 2025
…ield is present (elastic#134582)

* Fixed match only text block loader not working when a keyword multi field is present

* Update docs/changelog/134582.yaml

* Preemptively mute this test

* [CI] Auto commit changes from spotless

* Addressed feedback

* Update modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldTypeTests.java

Co-authored-by: Jordan Powers <[email protected]>

* Preemptively mute this test

* Fixed copyright

* Gate tests on feature presence

* [CI] Auto commit changes from spotless

* Revert muted-tests to main

---------

Co-authored-by: elasticsearchmachine <[email protected]>
Co-authored-by: Jordan Powers <[email protected]>
(cherry picked from commit 86227fb)

# Conflicts:
#	modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java
#	qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java
#	server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java
@Kubik42
Copy link
Contributor Author

Kubik42 commented Sep 18, 2025

💚 All backports created successfully

Status Branch Result
9.1
8.19

Questions ?

Please refer to the Backport tool documentation

Kubik42 added a commit that referenced this pull request Sep 18, 2025
…ulti field is present (#134582) (#135025)

* Fixed match only text block loader not working when a keyword multi field is present (#134582)

* Fixed match only text block loader not working when a keyword multi field is present

* Update docs/changelog/134582.yaml

* Preemptively mute this test

* [CI] Auto commit changes from spotless

* Addressed feedback

* Update modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldTypeTests.java

Co-authored-by: Jordan Powers <[email protected]>

* Preemptively mute this test

* Fixed copyright

* Gate tests on feature presence

* [CI] Auto commit changes from spotless

* Revert muted-tests to main

---------

Co-authored-by: elasticsearchmachine <[email protected]>
Co-authored-by: Jordan Powers <[email protected]>
(cherry picked from commit 86227fb)

# Conflicts:
#	server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java

* Removed non existent line in 9.1
Kubik42 added a commit that referenced this pull request Sep 18, 2025
…multi field is present (#134582) (#135027)

* Fixed match only text block loader not working when a keyword multi field is present (#134582)

* Fixed match only text block loader not working when a keyword multi field is present

* Update docs/changelog/134582.yaml

* Preemptively mute this test

* [CI] Auto commit changes from spotless

* Addressed feedback

* Update modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldTypeTests.java

Co-authored-by: Jordan Powers <[email protected]>

* Preemptively mute this test

* Fixed copyright

* Gate tests on feature presence

* [CI] Auto commit changes from spotless

* Revert muted-tests to main

---------

Co-authored-by: elasticsearchmachine <[email protected]>
Co-authored-by: Jordan Powers <[email protected]>
(cherry picked from commit 86227fb)

# Conflicts:
#	modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java
#	qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java
#	server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java

* Removed BWC test since its missing way too many dependencies
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 backport pending >bug :StorageEngine/Mapping The storage related side of mappings Team:StorageEngine v8.19.5 v9.1.5 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants