@@ -44,13 +44,14 @@ public class SubmitAsyncSearchRequest implements Validatable {
44
44
private Boolean keepOnCompletion ;
45
45
private TimeValue keepAlive ;
46
46
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 ;
47
49
48
50
/**
49
51
* Creates a new request
50
52
*/
51
53
public SubmitAsyncSearchRequest (SearchSourceBuilder source , String ... indices ) {
52
54
this .searchRequest = new SearchRequest (indices , source );
53
- searchRequest .setBatchedReduceSize (DEFAULT_BATCHED_REDUCE_SIZE );
54
55
}
55
56
56
57
/**
@@ -186,21 +187,20 @@ public Boolean getAllowPartialSearchResults() {
186
187
}
187
188
188
189
/**
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.
190
191
* 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.
193
193
*/
194
194
public void setBatchedReduceSize (int batchedReduceSize ) {
195
- this .searchRequest . setBatchedReduceSize ( batchedReduceSize ) ;
195
+ this .batchedReduceSize = batchedReduceSize ;
196
196
}
197
197
198
198
/**
199
199
* 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 .
201
201
*/
202
- public int getBatchedReduceSize () {
203
- return this .searchRequest . getBatchedReduceSize () ;
202
+ public Integer getBatchedReduceSize () {
203
+ return this .batchedReduceSize ;
204
204
}
205
205
206
206
/**
0 commit comments