# ES 6.x...how to get list of percolator queries in an index?

**URL:** <https://discuss.elastic.co/t/es-6-x-how-to-get-list-of-percolator-queries-in-an-index/126987>\
**Category:** Elasticsearch\
**Created:** [April 5, 2018, 7:16pm UTC](https://discuss.elastic.co/t/es-6-x-how-to-get-list-of-percolator-queries-in-an-index/126987 "2018-04-05T19:16:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andywilliams](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@andywilliams](https://discuss.elastic.co/u/andywilliams)\
**Post date:** [April 5, 2018, 7:16pm UTC](https://discuss.elastic.co/t/es-6-x-how-to-get-list-of-percolator-queries-in-an-index/126987/1 "2018-04-05T19:16:31Z")

</div>

How does one get a list of percolator documents, say with field query in an index?

Since ES 6.x, percolators are kept in same index as those documents they are querying, so I would have assumed I could get all percolator queries in an index like the below...  
GET /index/\_search  
{  
"query": {  
"bool": {  
"must": {  
"exists": {  
"field": "query"  
}  
}  
}  
}  
}  
But this does not return the percolator queries...the same query above works if I use a field that I have in some documents, like "user"...but I don't want to do a must\_not, which works, provided I have a field that every document in the index has, but not the percolator... I just want a query to get all of the percolators in a given index, or shoot, I'd like a query that would just get me all my percolators and I can figure out what /index they are in...

Anyone have any clue how to do this in ES 6.x?

My mappings was created like the below...  
PUT /index  
{  
"mappings": {  
"type": {  
"properties" : {  
"query": {  
"type" : "percolator"  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [April 6, 2018, 10:23am UTC](https://discuss.elastic.co/t/es-6-x-how-to-get-list-of-percolator-queries-in-an-index/126987/2 "2018-04-06T10:23:34Z")

</div>

I couldn't reproduce on the latest version, which suggests this problem is fixed. Does it work better if you check for existence of `query.query_builder_field` instead of just `query`?

---

<div class="post-metadata">

**Author:** ![andywilliams](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@andywilliams](https://discuss.elastic.co/u/andywilliams)\
**Post date:** [April 6, 2018, 2:35pm UTC](https://discuss.elastic.co/t/es-6-x-how-to-get-list-of-percolator-queries-in-an-index/126987/3 "2018-04-06T14:35:56Z")

</div>

> [@jpountz](#):
>
> query.query\_builder\_field

Yes! using query.query\_builder\_field does return the percolators.  
I'm using 6.1.1 btw, so definitely not the latest, at least on where I'm testing now, did think of trying the latest, but really thought I was missing something in what I was doing.  
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:** [May 4, 2018, 2:35pm UTC](https://discuss.elastic.co/t/es-6-x-how-to-get-list-of-percolator-queries-in-an-index/126987/4 "2018-05-04T14:35:58Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
