Skip to content

Conversation

@lkts
Copy link
Contributor

@lkts lkts commented Apr 28, 2025

This is a follow up to #127273 which discovered an issue with multi-fields together with fallback synthetic source and fixed it for text. This PR fixes that same problem for all block loaders.

@lkts lkts added the >test Issues or PRs that are addressing/adding tests label Apr 28, 2025
@lkts lkts changed the title Add tests for block loaders for multifields Add tests for block loaders of multifields Apr 28, 2025
@lkts lkts removed the >test Issues or PRs that are addressing/adding tests label Apr 29, 2025
@lkts lkts changed the title Add tests for block loaders of multifields Properly handle multi fields in block loaders with synthetic source enabled Apr 29, 2025
}

@Override
public String text() throws IOException {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually a fix for an edge case that the new test finds.

import static org.elasticsearch.index.mapper.BlockLoaderTestCase.buildSpecification;
import static org.elasticsearch.index.mapper.BlockLoaderTestCase.hasDocValues;

public class TextFieldWithParentBlockLoaderTests extends MapperServiceTestCase {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now a dedicated test for this case and it does not include "normal" tests that are covered in TextFieldBlockLoaderTests.

return null;
}

var map = commonMappingParameters();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This map was previously shared between invocations of a lambda returned by this method. That led to generated mappings being very similar most of the time which is not what we want.

import static org.apache.lucene.tests.util.LuceneTestCase.newDirectory;
import static org.apache.lucene.tests.util.LuceneTestCase.random;

public class BlockLoaderTestRunner {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed for TextFieldWithParentBlockLoaderTests to work.

@lkts lkts added auto-backport Automatically create backport pull requests when merged v8.19.0 :StorageEngine/Mapping The storage related side of mappings >non-issue labels Apr 29, 2025
@lkts lkts requested review from dnhatn and martijnvg April 29, 2025 17:49
@lkts lkts marked this pull request as ready for review April 29, 2025 17:49
@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks, Sasha!

@lkts lkts merged commit 0c1b3ac into elastic:main Apr 30, 2025
17 checks passed
@lkts lkts deleted the multi_field_block_loader_tests branch April 30, 2025 16:33
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

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

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

@lkts
Copy link
Contributor Author

lkts commented Apr 30, 2025

💚 All backports created successfully

Status Branch Result
8.19

Questions ?

Please refer to the Backport tool documentation

lkts added a commit that referenced this pull request Apr 30, 2025
…nabled (#127483) (#127581)

(cherry picked from commit 0c1b3ac)

# Conflicts:
#	server/src/test/java/org/elasticsearch/index/mapper/blockloader/GeoPointFieldBlockLoaderTests.java
@nik9000
Copy link
Member

nik9000 commented Jun 26, 2025

@lkts is this one still backport_pending?

@nik9000
Copy link
Member

nik9000 commented Jun 26, 2025

This is merged to 8.19.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants