# Multi type search for matching and non-matching fields

**URL:** <https://discuss.elastic.co/t/multi-type-search-for-matching-and-non-matching-fields/23128>\
**Category:** Elasticsearch\
**Created:** [April 7, 2015, 12:39pm UTC](https://discuss.elastic.co/t/multi-type-search-for-matching-and-non-matching-fields/23128 "2015-04-07T12:39:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ranjith\_Aravind](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@Ranjith\_Aravind](https://discuss.elastic.co/u/Ranjith_Aravind)\
**Post date:** [April 7, 2015, 12:39pm UTC](https://discuss.elastic.co/t/multi-type-search-for-matching-and-non-matching-fields/23128/1 "2015-04-07T12:39:22Z")

</div>

I am evaluating elastic search and not sure if the following requirement  
which I have is possible through elastic search.

I have the following data

1. /index/type1

{ "user": "user1"}  
{ "user": "user2"}  
{ "user": "user3"}

1. /index/type2

{ "user": "user1"}  
{ "user": "user2"}

Now I would like to retrieve the following:

1. Users that are in type1 but not in type 2 - user3
2. Users that are in both type1 and type2 - user1 and user2

Is this something which can be achieved through elastic search?

--  
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/f7d6652c-bca9-4ebd-be23-c82e4968c162%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f7d6652c-bca9-4ebd-be23-c82e4968c162%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:21am UTC](https://discuss.elastic.co/t/multi-type-search-for-matching-and-non-matching-fields/23128/2 "2017-07-06T00:21:10Z")

</div>


