-
Notifications
You must be signed in to change notification settings - Fork 24.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite search requests on the coordinating nodes (#25814)
This change rewrites search requests on the coordinating node before we send requests to the individual shards. This will reduce the rewrite load and object creation for each rewrite on the executing nodes and will fetch resources only once instead of N times once per shard for queries like `terms` query with index lookups. (among percolator and geo-shape) Relates to #25791
- Loading branch information
Showing
7 changed files
with
139 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
83 changes: 83 additions & 0 deletions
83
rest-api-spec/src/main/resources/rest-api-spec/test/search/150_rewrite_on_coordinator.yml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
"Ensure that we fetch the document only once": | ||
- skip: | ||
version: " - 5.99.99" | ||
reason: this was added in 6.0.0 | ||
|
||
- do: | ||
indices.create: | ||
index: search_index | ||
body: | ||
settings: | ||
number_of_shards: 5 | ||
mappings: | ||
doc: | ||
properties: | ||
user: | ||
type: keyword | ||
- do: | ||
index: | ||
index: search_index | ||
type: doc | ||
id: 1 | ||
body: { "user": "1" } | ||
|
||
- do: | ||
index: | ||
index: search_index | ||
type: doc | ||
id: 2 | ||
body: { "user": "2" } | ||
|
||
- do: | ||
index: | ||
index: search_index | ||
type: doc | ||
id: 3 | ||
body: { "user": "3" } | ||
|
||
- do: | ||
indices.refresh: {} | ||
|
||
- do: | ||
catch: /no such index/ | ||
search: | ||
index: "search_index" | ||
body: { "size" : 0, "query" : { "terms" : { "user" : { "index": "lookup_index", "type": "doc", "id": "1", "path": "followers"} } } } | ||
- do: | ||
indices.create: | ||
index: lookup_index | ||
body: | ||
settings: | ||
number_of_shards: 1 | ||
mappings: | ||
doc: | ||
properties: | ||
followers: | ||
type: keyword | ||
- do: | ||
index: | ||
index: lookup_index | ||
type: doc | ||
id: 1 | ||
body: { "followers" : ["1", "3"] } | ||
- do: | ||
indices.refresh: {} | ||
|
||
- do: | ||
search: | ||
index: "search_index" | ||
body: { "size" : 0, "query" : { "terms" : { "user" : { "index": "lookup_index", "type": "doc", "id": "1", "path": "followers"} } } } | ||
|
||
- match: { _shards.total: 5 } | ||
- match: { _shards.successful: 5 } | ||
- match: { _shards.skipped: 0 } | ||
- match: { _shards.failed: 0 } | ||
- match: { hits.total: 2 } | ||
|
||
- do: | ||
indices.stats: { index: 'lookup_index', "metric": "get"} | ||
|
||
- match: { indices.lookup_index.total.get.total: 1 } | ||
|
||
|
||
|