Skip to content

Conversation

@bcully
Copy link
Contributor

@bcully bcully commented Nov 18, 2025

This will allow us to install search filters on shards being split according to whether the coordinating node is including new search shards in its requests or not.

This will allow us to install search filters on shards being split according to whether
the coordinating node is including new search shards in its requests or not.
@bcully bcully requested a review from lkts November 18, 2025 19:45
@bcully bcully added >non-issue :Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. v9.3.0 labels Nov 18, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Indexing Meta label for Distributed Indexing team label Nov 18, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing)


// Allows subclasses to wrap the DirectoryReader before it is used to create Searchers
protected DirectoryReader wrapDirectoryReader(DirectoryReader reader) throws IOException {
protected DirectoryReader wrapDirectoryReader(DirectoryReader reader, SplitShardCountSummary ignored) 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 not a good abstraction. Open to better ideas!

Copy link
Contributor

@lkts lkts Nov 18, 2025

Choose a reason for hiding this comment

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

This is always called from acquireSearcherSupplier so maybe we can introduce AcquireSearcherRequest and pass it down here? Looking at naming in SearcherScope, something like having two variant AcquireSearcherRequest.Internal and AcquireSearcherRequest.External may work. I am not sure if summary is needed for internal searchers, it feels like it won't be?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We had a chat about this on slack, and I ended up refactoring this a little to make the wrapper only apply to external searches, but I think it's going to be easier to decide on the most generic way to apply the summary to the wrapper once we have all the calling paths figured out so we don't have all the default SplitShardCountSummary.UNSET paths.

@bcully bcully marked this pull request as draft November 18, 2025 19:52
@bcully bcully removed the request for review from lkts November 18, 2025 22:54
…erSupplier method

This is the one that is called by all the others. Should fix the test cases I looked at.
…lly/elasticsearch into reshard-install-source-search-filter
After reviewing the users of SearcherScope.INTERNAL none of them appear to
want filtering, so it is simpler and safer not to provide an interface for them to do so.
@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Nov 20, 2025
@bcully bcully marked this pull request as ready for review November 20, 2025 23:35
return acquireSearcherSupplier(Engine.SearcherScope.EXTERNAL);
}

public Engine.SearcherSupplier acquireSearcherSupplier(SplitShardCountSummary splitShardCountSummary) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we reflect that this is for external scopes only in the name of the method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could. I wasn't sure about it because the signature for the overload below acquireSearcherSupplier(Engine.SearcherScope scope) is public, but I guess we're going to be slowly trying to remove callers of it and maybe mark it deprecated due to the fact that it doesn't have a shard count summary in the external case, in favor of calling internal and external acquirers.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's my expectation as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@bcully bcully self-assigned this Nov 24, 2025
Call the variant that takes a splitShardCountSummary acquireExternalSearcherSupplier.
@bcully bcully merged commit e33f903 into elastic:main Nov 24, 2025
34 checks passed
@bcully bcully deleted the reshard-install-source-search-filter branch November 24, 2025 20:39
afoucret pushed a commit to afoucret/elasticsearch that referenced this pull request Nov 26, 2025
This will allow us to install search filters on shards being split according to whether
the coordinating node is including new search shards in its requests or not.

Move wrapDirectoryReader to wrapExternalDirectoryReader.

After reviewing the users of SearcherScope.INTERNAL none of them appear to
want filtering, so it is simpler and safer not to provide an interface for them to do so.
ncordon pushed a commit to ncordon/elasticsearch that referenced this pull request Nov 26, 2025
This will allow us to install search filters on shards being split according to whether
the coordinating node is including new search shards in its requests or not.

Move wrapDirectoryReader to wrapExternalDirectoryReader.

After reviewing the users of SearcherScope.INTERNAL none of them appear to
want filtering, so it is simpler and safer not to provide an interface for them to do so.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. >non-issue serverless-linked Added by automation, don't add manually Team:Distributed Indexing Meta label for Distributed Indexing team v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants