# Passing JSON string in URL (query string) to \_percolate

**URL:** <https://discuss.elastic.co/t/passing-json-string-in-url-query-string-to--percolate/7492>\
**Category:** Elasticsearch\
**Created:** [April 27, 2012, 1:02pm UTC](https://discuss.elastic.co/t/passing-json-string-in-url-query-string-to--percolate/7492 "2012-04-27T13:02:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jschelle\_2](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jschelle\_2](https://discuss.elastic.co/u/jschelle_2)\
**Post date:** [April 27, 2012, 1:02pm UTC](https://discuss.elastic.co/t/passing-json-string-in-url-query-string-to--percolate/7492/1 "2012-04-27T13:02:04Z")

</div>

ElasticSearch claims that"for libraries don't support have a body for an  
HTTP GET call, you can use the source variable in the URL query string.  
However after days, I can't get this to work for a \_percolate call. Has  
anyone done this?? I'm using Java and trying to compare performance of  
straight HTTP to the Java API.

here it is in CURL:

curl -XPOST '[http://localhost:9200/test5/site](http://localhost:9200/test5/site)' -d  
'{"query":{"term":{"content":"jason"}}}'

curl -XGET  
'[http://localhost:9200/test5/site/\_percolate?source={"doc":{"content":jason"}](http://localhost:9200/test5/site/_percolate?source=%7B%22doc%22:%7B%22content%22:jason%22%7D)}'  
{"error":"ElasticSearchParseException[Failed to derive xcontent from  
(offset=0, length=0): []]","status":400}

The error message sounds like its not even noticing the source parameter.  
Has anyone successfully done this? In any language??

Please help, thanks.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 29, 2012, 4:40pm UTC](https://discuss.elastic.co/t/passing-json-string-in-url-query-string-to--percolate/7492/2 "2012-04-29T16:40:15Z")

</div>

Passing source as a parameter is not supported for percolate (source is  
supported for search operations). You can use POST as well, no just GET.  
Where did you find that comment?

On Fri, Apr 27, 2012 at 4:02 PM, jschelle [jason.scheller@gmail.com](mailto:jason.scheller@gmail.com) wrote:

> Elasticsearch claims that"for libraries don't support have a body for an  
> HTTP GET call, you can use the source variable in the URL query string.  
> However after days, I can't get this to work for a \_percolate call. Has  
> anyone done this?? I'm using Java and trying to compare performance of  
> straight HTTP to the Java API.
> 
> here it is in CURL:
> 
> curl -XPOST '[http://localhost:9200/test5/site](http://localhost:9200/test5/site)' -d  
> '{"query":{"term":{"content":"jason"}}}'
> 
> curl -XGET '[http://localhost:9200/test5/site/\_percolate?source=\](http://localhost:9200/test5/site/_percolate?source=%5C){  
> "doc":{"content":jason"}}'  
> {"error":"ElasticSearchParseException[Failed to derive xcontent from  
> (offset=0, length=0): ]","status":400}
> 
> The error message sounds like its not even noticing the source parameter.  
> Has anyone successfully done this? In any language??
> 
> Please help, thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:30am UTC](https://discuss.elastic.co/t/passing-json-string-in-url-query-string-to--percolate/7492/3 "2017-07-06T03:30:41Z")

</div>


