Skip to content

Commit e594083

Browse files
author
Christoph Büscher
committed
Hide batchedReducedSize from inner SearchRequest
1 parent aa4ab12 commit e594083

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

client/rest-high-level/src/main/java/org/elasticsearch/client/AsyncSearchRequestConverters.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static void addSearchRequestParams(Params params, SubmitAsyncSearchRequest reque
7373
if (request.getAllowPartialSearchResults() != null) {
7474
params.withAllowPartialResults(request.getAllowPartialSearchResults());
7575
}
76-
if (request.getBatchedReduceSize() != SubmitAsyncSearchRequest.DEFAULT_BATCHED_REDUCE_SIZE) {
76+
if (request.getBatchedReduceSize() != null) {
7777
params.withBatchedReduceSize(request.getBatchedReduceSize());
7878
}
7979
}

client/rest-high-level/src/main/java/org/elasticsearch/client/asyncsearch/SubmitAsyncSearchRequest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ public class SubmitAsyncSearchRequest implements Validatable {
4444
private Boolean keepOnCompletion;
4545
private TimeValue keepAlive;
4646
private final SearchRequest searchRequest;
47+
// The following is optional and will only be sent down with the request if explicitely set by the user
48+
private Integer batchedReduceSize;
4749

4850
/**
4951
* Creates a new request
5052
*/
5153
public SubmitAsyncSearchRequest(SearchSourceBuilder source, String... indices) {
5254
this.searchRequest = new SearchRequest(indices, source);
53-
searchRequest.setBatchedReduceSize(DEFAULT_BATCHED_REDUCE_SIZE);
5455
}
5556

5657
/**
@@ -186,21 +187,20 @@ public Boolean getAllowPartialSearchResults() {
186187
}
187188

188189
/**
189-
* Sets the number of shard results that should be reduced at once on the coordinating node.
190+
* Optional. Sets the number of shard results that should be reduced at once on the coordinating node.
190191
* This value should be used as a protection mechanism to reduce the memory overhead per search
191-
* request if the potential number of shards in the request can be large.
192-
* This defaults to 5 for {@link SubmitAsyncSearchRequest}.
192+
* request if the potential number of shards in the request can be large. Defaults to 5.
193193
*/
194194
public void setBatchedReduceSize(int batchedReduceSize) {
195-
this.searchRequest.setBatchedReduceSize(batchedReduceSize);
195+
this.batchedReduceSize = batchedReduceSize;
196196
}
197197

198198
/**
199199
* Gets the number of shard results that should be reduced at once on the coordinating node.
200-
* This defaults to 5 for {@link SubmitAsyncSearchRequest}.
200+
* Returns <tt>null</tt> if unset.
201201
*/
202-
public int getBatchedReduceSize() {
203-
return this.searchRequest.getBatchedReduceSize();
202+
public Integer getBatchedReduceSize() {
203+
return this.batchedReduceSize;
204204
}
205205

206206
/**

0 commit comments

Comments
 (0)