Count / Delete By Query API: Add source parameter to pass the json body, closes #142.
This commit is contained in:
parent
19b355e9f0
commit
fbc138e38c
|
@ -26,6 +26,7 @@ import org.elasticsearch.index.query.json.JsonQueryBuilders;
|
||||||
import org.elasticsearch.index.query.json.QueryStringJsonQueryBuilder;
|
import org.elasticsearch.index.query.json.QueryStringJsonQueryBuilder;
|
||||||
import org.elasticsearch.rest.RestRequest;
|
import org.elasticsearch.rest.RestRequest;
|
||||||
import org.elasticsearch.util.Strings;
|
import org.elasticsearch.util.Strings;
|
||||||
|
import org.elasticsearch.util.Unicode;
|
||||||
import org.elasticsearch.util.json.JsonBuilder;
|
import org.elasticsearch.util.json.JsonBuilder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -67,6 +68,10 @@ public class RestActions {
|
||||||
if (request.hasContent()) {
|
if (request.hasContent()) {
|
||||||
return request.contentAsBytes();
|
return request.contentAsBytes();
|
||||||
}
|
}
|
||||||
|
String source = request.param("source");
|
||||||
|
if (source != null) {
|
||||||
|
return Unicode.fromStringAsBytes(source);
|
||||||
|
}
|
||||||
String queryString = request.param("q");
|
String queryString = request.param("q");
|
||||||
if (queryString == null) {
|
if (queryString == null) {
|
||||||
throw new ElasticSearchIllegalArgumentException("No query to execute, not in body, and not bounded to 'q' parameter");
|
throw new ElasticSearchIllegalArgumentException("No query to execute, not in body, and not bounded to 'q' parameter");
|
||||||
|
|
Loading…
Reference in New Issue