Percolate api: support encoded body as query string param consistently
The percolate api doesn't parse the encoded body provided as `source` query string parameter, when percolating an existing document. Fixed and added REST test that would have caught this since we randomly use GET + encoded `source` param instead of GET + request body in our java runner (the perl runner does the same too). Closes #9628
This commit is contained in:
parent
b3474f6b25
commit
9c847db8af
|
@ -13,6 +13,7 @@
|
||||||
body:
|
body:
|
||||||
query:
|
query:
|
||||||
match_all: {}
|
match_all: {}
|
||||||
|
tag: tag1
|
||||||
|
|
||||||
- do:
|
- do:
|
||||||
index:
|
index:
|
||||||
|
@ -84,3 +85,28 @@
|
||||||
version: 1
|
version: 1
|
||||||
percolate_index: percolator_index
|
percolate_index: percolator_index
|
||||||
percolate_type: test_type
|
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}]}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class RestPercolateAction extends BaseRestHandler {
|
||||||
percolateRequest.getRequest(getRequest);
|
percolateRequest.getRequest(getRequest);
|
||||||
percolateRequest.routing(restRequest.param("percolate_routing"));
|
percolateRequest.routing(restRequest.param("percolate_routing"));
|
||||||
percolateRequest.preference(restRequest.param("percolate_preference"));
|
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()));
|
percolateRequest.indicesOptions(IndicesOptions.fromRequest(restRequest, percolateRequest.indicesOptions()));
|
||||||
executePercolate(percolateRequest, restChannel, client);
|
executePercolate(percolateRequest, restChannel, client);
|
||||||
|
|
Loading…
Reference in New Issue