From fbc138e38ccc64df9d05297d49bac881bbb978a0 Mon Sep 17 00:00:00 2001 From: kimchy Date: Sat, 17 Apr 2010 23:06:27 +0300 Subject: [PATCH] Count / Delete By Query API: Add source parameter to pass the json body, closes #142. --- .../org/elasticsearch/rest/action/support/RestActions.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support/RestActions.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support/RestActions.java index 9446163b425..4c642355742 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support/RestActions.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/support/RestActions.java @@ -26,6 +26,7 @@ import org.elasticsearch.index.query.json.JsonQueryBuilders; import org.elasticsearch.index.query.json.QueryStringJsonQueryBuilder; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.util.Strings; +import org.elasticsearch.util.Unicode; import org.elasticsearch.util.json.JsonBuilder; import java.io.IOException; @@ -67,6 +68,10 @@ public class RestActions { if (request.hasContent()) { return request.contentAsBytes(); } + String source = request.param("source"); + if (source != null) { + return Unicode.fromStringAsBytes(source); + } String queryString = request.param("q"); if (queryString == null) { throw new ElasticSearchIllegalArgumentException("No query to execute, not in body, and not bounded to 'q' parameter");