I've an index structure where types are dates and each type has several documents. I want to get all documents present in type-1 but must be absent in type-2. As an example:

    Type-1 ---> id list = [1,2,3,4,5,6]
    Type-2 ---> id list = [2,3,7,8,9]
The query i'm looking for should return documents from type-1 only with id = [1,4,5,6] I'm using es-py client for the above purpose.

PS: I can always get documents matching type-1 and type-2 individually followed by iterating through both of them to get what i need. But this is a solution i want to avoid for sake of performance.

Edit 1: Someone on stackoverflow suggested me the below query:

    POST _search
      "query": {
        "bool" : {
          "must" : {
            "term" : { "_type" : "Type-1" }
          "must_not" : {
            "term" : { "_type" : "Type-2" }
but its not going to work as it'll give me all documents present in type-1 which do not have _type equal to Type-2. This is basically equivalent to giving all documents matching Type-1. **This is not what i want.**