Multi type search for matching and non-matching fields

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
To view this discussion on the web visit
For more options, visit