diff --git a/rest-api-spec/test/percolate/16_existing_doc.yaml b/rest-api-spec/test/percolate/16_existing_doc.yaml index a539b0f8089..2430fe63a02 100644 --- a/rest-api-spec/test/percolate/16_existing_doc.yaml +++ b/rest-api-spec/test/percolate/16_existing_doc.yaml @@ -13,6 +13,7 @@ body: query: match_all: {} + tag: tag1 - do: index: @@ -84,3 +85,28 @@ version: 1 percolate_index: percolator_index percolate_type: test_type + + - do: + percolate: + index: percolator_index + type: test_type + id: 1 + body: + filter: + term: + tag: non_existing_tag + + - match: {'matches': []} + + - do: + percolate: + index: percolator_index + type: test_type + id: 1 + body: + filter: + term: + tag: tag1 + + - match: {'matches': [{_index: percolator_index, _id: test_percolator}]} + diff --git a/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java b/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java index 4f24c82c3cf..0736ec5d742 100644 --- a/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java @@ -87,7 +87,7 @@ public class RestPercolateAction extends BaseRestHandler { percolateRequest.getRequest(getRequest); percolateRequest.routing(restRequest.param("percolate_routing")); percolateRequest.preference(restRequest.param("percolate_preference")); - percolateRequest.source(restRequest.content(), restRequest.contentUnsafe()); + percolateRequest.source(RestActions.getRestContent(restRequest), restRequest.contentUnsafe()); percolateRequest.indicesOptions(IndicesOptions.fromRequest(restRequest, percolateRequest.indicesOptions())); executePercolate(percolateRequest, restChannel, client);