# Filter percolators by attributes

**URL:** <https://discuss.elastic.co/t/filter-percolators-by-attributes/133550>\
**Category:** Elasticsearch\
**Created:** [May 28, 2018, 1:26pm UTC](https://discuss.elastic.co/t/filter-percolators-by-attributes/133550 "2018-05-28T13:26:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Inventorix](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@Inventorix](https://discuss.elastic.co/u/Inventorix)\
**Post date:** [May 28, 2018, 1:26pm UTC](https://discuss.elastic.co/t/filter-percolators-by-attributes/133550/1 "2018-05-28T13:26:53Z")

</div>

Hello together,

I would like to filter my percolators by attributes like category .

Example I tried:

POST /test/test  
{  
"query" : {  
"match" : {  
"message" : "buy"  
}  
},  
"category": "Sales"  
}

GET /test/test/\_search  
{  
"query" : {  
"percolate" : {  
"field" : "query",  
"document" : {  
"message" : "I buy a car"  
}  
}  
},  
"filter" : {"term" : {"category" : "Sales"}}  
}  
}

PUT /test  
{  
"mappings": {  
"test": {  
"properties": {  
"message": {  
"type": "text"  
},  
"category":{  
"type":"text"  
},  
"query": {  
"type": "percolator"  
}}}  
}

I am getting an error when trying to GET the results. Is that the right way to fulfill my intention.  
The aim is to get only the percolators with category "Sales". Thanks in advance.

---

<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:** [June 25, 2018, 1:27pm UTC](https://discuss.elastic.co/t/filter-percolators-by-attributes/133550/2 "2018-06-25T13:27:53Z")

</div>

Closed on June 25, 2018, 1:27pm UTC

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