Include preference in _count serialization and builder. [#2698]

This commit is contained in:
Drew Raines 2013-02-27 08:10:31 -06:00 committed by Drew Raines
parent ffbdc0a4c3
commit cb7a569f4b
2 changed files with 13 additions and 0 deletions

View File

@ -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);
}

View File

@ -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.
*/