Added utility method to CountRequestBuilder

Allows to add a query to CountRequestBuilder as a XContentBuilder.

Closes #8594
This commit is contained in:
ananich 2014-11-21 19:26:37 +03:00 committed by Simon Willnauer
parent 1c00790213
commit 95a396159c
1 changed files with 9 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import org.elasticsearch.action.support.QuerySourceBuilder;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilder;
/**
@ -98,6 +99,14 @@ public class CountRequestBuilder extends BroadcastOperationRequestBuilder<CountR
sourceBuilder().setQuery(queryBinary);
return this;
}
/**
* Constructs a new builder with a raw search query.
*/
public CountRequestBuilder setQuery(XContentBuilder query) {
return setQuery(query.bytes());
}
/**
* The source to execute.