# How to Filter the serach in elasticsearch

**URL:** <https://discuss.elastic.co/t/how-to-filter-the-serach-in-elasticsearch/16558>\
**Category:** Elasticsearch\
**Created:** [March 24, 2014, 8:54am UTC](https://discuss.elastic.co/t/how-to-filter-the-serach-in-elasticsearch/16558 "2014-03-24T08:54:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahesh\_Chary](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@Mahesh\_Chary](https://discuss.elastic.co/u/Mahesh_Chary)\
**Post date:** [March 24, 2014, 8:54am UTC](https://discuss.elastic.co/t/how-to-filter-the-serach-in-elasticsearch/16558/1 "2014-03-24T08:54:40Z")

</div>

Hi ,  
i have some indexed fields like: { text:some text, id:123,  
author:mahesh },{ text:some text, id:124, author:rajesh }.........{},i  
want to search a "word" from the object where author is mahesh not in other  
objects by elasticsearch using node ...please help me how to prepare a  
query object.

currently i am using this query which returns matches from all indexed  
fields but i want to search a keyword in a particular author

query:

{"query" : {  
term:{text:"grade"}  
}

}

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4258c8fb-c552-42c8-82d1-1391929bcf5b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4258c8fb-c552-42c8-82d1-1391929bcf5b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Herbert\_Bodner](https://avatars.discourse-cdn.com/v4/letter/h/a4c791/32.png) [@Herbert\_Bodner](https://discuss.elastic.co/u/Herbert_Bodner)\
**Post date:** [March 24, 2014, 9:15am UTC](https://discuss.elastic.co/t/how-to-filter-the-serach-in-elasticsearch/16558/2 "2014-03-24T09:15:57Z")

</div>

You need a Filter query in conjunction the query, see:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

something like this, Though, I am not sure, if this is entirely correct,  
but you get the idea:

{  
"filtered" : {  
"query" : {  
"term" : { "author" : "myauthor" }  
},  
"filter" : {  
"term" : {  
"text" : "grade" }  
}  
}  
}  
}

On Monday, March 24, 2014 9:54:40 AM UTC+1, Mahesh Chary wrote:

> Hi ,  
> i have some indexed fields like: { text:some text, id:123,  
> author:mahesh },{ text:some text, id:124, author:rajesh }.........{},i  
> want to search a "word" from the object where author is mahesh not in other  
> objects by elasticsearch using node ...please help me how to prepare a  
> query object.
> 
> currently i am using this query which returns matches from all indexed  
> fields but i want to search a keyword in a particular author
> 
> query:
> 
> {"query" : {  
> term:{text:"grade"}  
> }
> 
> }

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/52d7e8b0-a9c9-4541-9ad0-d3eeb445fdb2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/52d7e8b0-a9c9-4541-9ad0-d3eeb445fdb2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:41am UTC](https://discuss.elastic.co/t/how-to-filter-the-serach-in-elasticsearch/16558/3 "2017-07-06T01:41:13Z")

</div>


