Include preference in _count serialization and builder. [#2698]
This commit is contained in:
parent
ffbdc0a4c3
commit
cb7a569f4b
|
@ -237,6 +237,7 @@ public class CountRequest extends BroadcastOperationRequest<CountRequest> {
|
|||
super.readFrom(in);
|
||||
minScore = in.readFloat();
|
||||
routing = in.readOptionalString();
|
||||
preference = in.readOptionalString();
|
||||
querySourceUnsafe = false;
|
||||
querySource = in.readBytesReference();
|
||||
types = in.readStringArray();
|
||||
|
@ -247,6 +248,7 @@ public class CountRequest extends BroadcastOperationRequest<CountRequest> {
|
|||
super.writeTo(out);
|
||||
out.writeFloat(minScore);
|
||||
out.writeOptionalString(routing);
|
||||
out.writeOptionalString(preference);
|
||||
out.writeBytesReference(querySource);
|
||||
out.writeStringArray(types);
|
||||
}
|
||||
|
|
|
@ -60,6 +60,17 @@ public class CountRequestBuilder extends BroadcastOperationRequestBuilder<CountR
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the preference to execute the search. Defaults to randomize across shards. Can be set to
|
||||
* <tt>_local</tt> to prefer local shards, <tt>_primary</tt> to execute only on primary shards,
|
||||
* _shards:x,y to operate on shards x & y, or a custom value, which guarantees that the same order
|
||||
* will be used across different requests.
|
||||
*/
|
||||
public CountRequestBuilder setPreference(String preference) {
|
||||
request.preference(preference);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The routing values to control the shards that the search will be executed on.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue