-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Add additional shards routing info in ShardSearchRequest #29533
Changes from 1 commit
b45f64e
b90716c
a16e22b
6fb78b3
2ef8f66
9fedb3b
8289993
02a91a4
ca87ce7
36ac087
803c88a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,15 @@ public interface ShardSearchRequest { | |
|
||
ShardId shardId(); | ||
|
||
/** | ||
* Returns the remapped shard id of the requested shard for this request | ||
* or -1 if this information is not available. | ||
* The remapped shard id is the id of the requested shard among all shards | ||
* of this index that are part of the request. Note that the remapped shard id | ||
* is equal to the original shard id if all shards of this index are part of the request. | ||
*/ | ||
int remapShardId(); | ||
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. I wonder if we should call it 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. +1. I pushed b90716c |
||
|
||
String[] types(); | ||
|
||
SearchSourceBuilder source(); | ||
|
@@ -59,6 +68,15 @@ public interface ShardSearchRequest { | |
|
||
void source(SearchSourceBuilder source); | ||
|
||
/** | ||
* Returns the number of shards of this index ({@link ShardId#getIndex()}) that participates in the request | ||
* or -1 if this information is not available. | ||
*/ | ||
int numberOfIndexShards(); | ||
|
||
/** | ||
* Returns the number of shards that participates in the request. | ||
*/ | ||
int numberOfShards(); | ||
|
||
SearchType searchType(); | ||
|
@@ -68,7 +86,7 @@ public interface ShardSearchRequest { | |
long nowInMillis(); | ||
|
||
Boolean requestCache(); | ||
|
||
Boolean allowPartialSearchResults(); | ||
|
||
Scroll scroll(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is quite a complex operation since we call if for every shard and then do consume the entire iterator again. I wonder if we can pre-sort the ShardRoutings in
SearchShardIterator
and then calculate this on the fly and simply callSearchShardIterator#getIndexShardOrdinal()
to get it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the logic to compute the needed informations only once in
InitialSearchPhase
constructor. I need the completeGroupShardsIterator
to do so which is why it's not inSearchShardIterator
but it's the same idea:b90716c