Skip to content

Commit 7040cb7

Browse files
bzhangamsaratvemulapalli
authored andcommitted
Use QueryCoordinatorContext for the rewrite in validate API. (opensearch-project#18272)
Signed-off-by: Bo Zhang <bzhangam@amazon.com> Signed-off-by: Sarat Vemulapalli <vemulapallisarat@gmail.com> Co-authored-by: Sarat Vemulapalli <vemulapallisarat@gmail.com>
1 parent a03bb2c commit 7040cb7

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2424
- Support create mode in pull-based ingestion and add retries for transient failures ([#18250](https://github.com/opensearch-project/OpenSearch/pull/18250)))
2525
- Decouple the init of Crypto Plugin and KeyProvider in CryptoRegistry ([18270](https://github.com/opensearch-project/OpenSearch/pull18270)))
2626
- Support cluster write block in pull-based ingestion ([#18280](https://github.com/opensearch-project/OpenSearch/pull/18280)))
27+
- Use QueryCoordinatorContext for the rewrite in validate API. ([#18272](https://github.com/opensearch-project/OpenSearch/pull/18272))
2728
- Supporting Scripted Metric Aggregation when reducing aggregations in InternalValueCount and InternalAvg ([18288](https://github.com/opensearch-project/OpenSearch/pull18270)))
2829

2930
### Changed

server/src/main/java/org/opensearch/action/admin/indices/validate/query/TransportValidateQueryAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ protected void doExecute(Task task, ValidateQueryRequest request, ActionListener
136136
if (request.query() == null) {
137137
rewriteListener.onResponse(request.query());
138138
} else {
139-
Rewriteable.rewriteAndFetch(request.query(), searchService.getValidationRewriteContext(timeProvider), rewriteListener);
139+
Rewriteable.rewriteAndFetch(request.query(), searchService.getValidationRewriteContext(timeProvider, request), rewriteListener);
140140
}
141141
}
142142

server/src/main/java/org/opensearch/search/SearchService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,17 +1783,17 @@ private void rewriteAndFetchShardRequest(IndexShard shard, ShardSearchRequest re
17831783
}
17841784

17851785
/**
1786-
* Returns a new {@link QueryRewriteContext} with the given {@code now} provider
1786+
* Returns a new {@link QueryCoordinatorContext} with the given {@code now} provider and {@link IndicesRequest searchRequest}
17871787
*/
17881788
public QueryRewriteContext getRewriteContext(LongSupplier nowInMillis, IndicesRequest searchRequest) {
17891789
return new QueryCoordinatorContext(indicesService.getRewriteContext(nowInMillis), searchRequest);
17901790
}
17911791

17921792
/**
1793-
* Returns a new {@link QueryRewriteContext} for query validation with the given {@code now} provider
1793+
* Returns a new {@link QueryCoordinatorContext} with the given {@code now} provider and {@link IndicesRequest searchRequest}
17941794
*/
1795-
public QueryRewriteContext getValidationRewriteContext(LongSupplier nowInMillis) {
1796-
return indicesService.getValidationRewriteContext(nowInMillis);
1795+
public QueryRewriteContext getValidationRewriteContext(LongSupplier nowInMillis, IndicesRequest searchRequest) {
1796+
return new QueryCoordinatorContext(indicesService.getValidationRewriteContext(nowInMillis), searchRequest);
17971797
}
17981798

17991799
public IndicesService getIndicesService() {

0 commit comments

Comments
 (0)