test fixes
This commit is contained in:
parent
e8ef63cc00
commit
81491843f1
|
@ -58,7 +58,7 @@ public class CountRequest extends BroadcastRequest<CountRequest> {
|
||||||
|
|
||||||
private int terminateAfter = DEFAULT_TERMINATE_AFTER;
|
private int terminateAfter = DEFAULT_TERMINATE_AFTER;
|
||||||
|
|
||||||
private QueryBuilder<?> queryBuilder = null;
|
private SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new count request against the provided indices. No indices provided means it will
|
* Constructs a new count request against the provided indices. No indices provided means it will
|
||||||
|
@ -88,13 +88,11 @@ public class CountRequest extends BroadcastRequest<CountRequest> {
|
||||||
/**
|
/**
|
||||||
* The query to execute
|
* The query to execute
|
||||||
*/
|
*/
|
||||||
public CountRequest query(QueryBuilder<?> queryBuilder) {
|
public CountRequest query(QueryBuilder queryBuilder) {
|
||||||
this.queryBuilder = queryBuilder;
|
this.searchSourceBuilder = new SearchSourceBuilder().query(queryBuilder);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The types of documents the query will run against. Defaults to all types.
|
* The types of documents the query will run against. Defaults to all types.
|
||||||
*/
|
*/
|
||||||
|
@ -171,16 +169,18 @@ public class CountRequest extends BroadcastRequest<CountRequest> {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String sSource = "_na_";
|
String sSource = "_na_";
|
||||||
try {
|
try {
|
||||||
sSource = XContentHelper.toString(queryBuilder);
|
sSource = XContentHelper.toString(searchSourceBuilder);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
return "[" + Arrays.toString(indices) + "]" + Arrays.toString(types) + ", source[" + sSource + "]";
|
return "[" + Arrays.toString(indices) + "]" + Arrays.toString(types) + ", source[" + sSource + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String sourceBuilderString() {
|
||||||
|
return searchSourceBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public SearchRequest toSearchRequest() {
|
public SearchRequest toSearchRequest() {
|
||||||
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
||||||
searchSourceBuilder.query(queryBuilder);
|
|
||||||
searchSourceBuilder.size(0);
|
searchSourceBuilder.size(0);
|
||||||
if (minScore() != DEFAULT_MIN_SCORE) {
|
if (minScore() != DEFAULT_MIN_SCORE) {
|
||||||
searchSourceBuilder.minScore(minScore());
|
searchSourceBuilder.minScore(minScore());
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.ActionListener;
|
||||||
import org.elasticsearch.action.search.SearchAction;
|
import org.elasticsearch.action.search.SearchAction;
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
import org.elasticsearch.action.support.DelegatingActionListener;
|
import org.elasticsearch.action.support.DelegatingActionListener;
|
||||||
import org.elasticsearch.action.support.QuerySourceBuilder;
|
|
||||||
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
|
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
|
||||||
import org.elasticsearch.client.ElasticsearchClient;
|
import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
import org.elasticsearch.index.query.QueryBuilder;
|
||||||
|
@ -107,9 +106,6 @@ public class CountRequestBuilder extends BroadcastOperationRequestBuilder<CountR
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (request != null) {
|
return request.sourceBuilderString();
|
||||||
return request.toString();
|
|
||||||
}
|
|
||||||
return new QuerySourceBuilder().toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue