# Filter/Term Query on 2 different fields

**URL:** https://discuss.elastic.co/t/filter-term-query-on-2-different-fields/20847
**Category:** Elasticsearch
**Created:** [November 19, 2014, 8:22pm UTC](https://discuss.elastic.co/t/filter-term-query-on-2-different-fields/20847 "2014-11-19T20:22:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ap1](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@Ap1](https://discuss.elastic.co/u/Ap1)
#### Post date: [November 19, 2014, 8:22pm UTC](https://discuss.elastic.co/t/filter-term-query-on-2-different-fields/20847/1 "2014-11-19T20:22:04Z")

</div>

1. I have a query that looks for specific Terms in multiple fields.

Eg. for 2 different fields below

1st level filter --\> source = XYZ  
2nd level filter --\> name = John

The query needs to find all documents that have source = xyz and then  
source = John.

1. I also need to make a variation of the query that looks for below

1st level filter --\> Source not equal to XYZ, ABC  
2nd filter --\> name = John

Thanks

--  
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/9f2a4d14-42d7-45a4-af89-8a37a7e690ca%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9f2a4d14-42d7-45a4-af89-8a37a7e690ca%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, 12:48am UTC](https://discuss.elastic.co/t/filter-term-query-on-2-different-fields/20847/2 "2017-07-06T00:48:54Z")

</div>


