# Percolate and Query Strings

**URL:** <https://discuss.elastic.co/t/percolate-and-query-strings/9000>\
**Category:** Elasticsearch\
**Created:** [September 12, 2012, 7:31am UTC](https://discuss.elastic.co/t/percolate-and-query-strings/9000 "2012-09-12T07:31:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christoph\_Kempen](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@Christoph\_Kempen](https://discuss.elastic.co/u/Christoph_Kempen)\
**Post date:** [September 12, 2012, 7:31am UTC](https://discuss.elastic.co/t/percolate-and-query-strings/9000/1 "2012-09-12T07:31:54Z")

</div>

Hi,

What is the correct way to add a query string to a percolator. For example,  
this is one that is working fine with only filters:

{  
"\_index": "\_percolator",  
"\_type": "document",  
"\_id": "0e63ed80-fc58-11e1-9857-f17a6fbf875a",  
"\_version": 1,  
"exists": true,  
"\_source": {"query": {  
"filtered": {  
"query": {  
"match\_all": {}  
},  
"filter": {  
"and": [  
{"missing": {"field": "redirect"}},  
{"term": {"field": "value"}}  
]}  
}}}  
}

But this one doesn't work:

{  
"\_index": "\_percolator",  
"\_type": "document",  
"\_id": "4984ebe0-fc65-11e1-a1c7-8bc204bcd862",  
"\_version": 1,  
"exists": true,  
"\_source": {"query":  
{"filtered": {  
"query": {  
"query\_string": {"query": "some query"}  
},  
"filter": {  
"and": [  
{"missing": {"field": "redirect"}},  
{"term": {"field": "value"}}  
]}  
}  
}  
}  
}

The query by itself is producing results.

Is it even possible to use a percolate with a query string?

Christoph

--

---

<div class="post-metadata">

**Author:** ![Christoph\_Kempen](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@Christoph\_Kempen](https://discuss.elastic.co/u/Christoph_Kempen)\
**Post date:** [September 13, 2012, 5:43pm UTC](https://discuss.elastic.co/t/percolate-and-query-strings/9000/2 "2012-09-13T17:43:49Z")

</div>

No hints anyone?

--

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [September 13, 2012, 6:47pm UTC](https://discuss.elastic.co/t/percolate-and-query-strings/9000/3 "2012-09-13T18:47:34Z")

</div>

Hi

> What is the correct way to add a query string to a percolator. For  
> example, this is one that is working fine with only filters:

> The query by itself is producing results.
> 
> Is it even possible to use a percolate with a query string?

Yes it is. I suggest you gist a curl recreation of the whole problem so  
that we can see exactly what is happening. Much easier to test when we  
can just copy and paste

clint

--

---

<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:12am UTC](https://discuss.elastic.co/t/percolate-and-query-strings/9000/4 "2017-07-06T03:12:50Z")

</div>


