title: ElasticSearch nested bool queries
body: <p>I'm using ElasticSearch 5.6. I have following JSON document. </p>
  
  <pre><code>    {
            "cards": [{
                          "tag_categories": [
                              {
                                  "is_sensitive": true,
                                  "category": "Users",
                                  "tags": [
                                      {
                                          "is_selected": true,
                                          "name": "user1"
                                      },
                                      {
                                          "is_selected": true,
                                          "name": "user2"
                                      },
                                      {
                                          "is_selected": false,
                                          "name": "user3"
                                      }
                                  ]
                              }
                          ],
                          "risk": "medium",
                          "position": 1,
                          "placement": 4,
                          "title": "test title",
  
                      }, ...]
         }
  </code></pre>
  
  <p>I want to return this document if all the given users names and corresponding is_selected value is true. </p>
  
  <p>This is my query.</p>
  
  <pre><code>{
    "_source": {
      "excludes": ["cards.pages"]
    },
    "query": {
      "bool": {
        "must": [{
          "match": {
            "_all": "hello world"
      }
    }],
    "filter": [{
        "nested": {
          "path": "cards.tag_categories.tags",
          "query": {
            "bool": {
              "must": [
                  {
                  "bool": {
                    "must": [
                      {
                        "match": {
                          "cards.tag_categories.tags.name": "user2"
                        }
                      },
                      {
                        "match": {
                          "cards.tag_categories.tags.is_selected": true
                        }
                      }
  
                    ]
                  }
                },
                {
                  "bool": {
                    "must": [
                      {
                        "match": {
                          "cards.tag_categories.tags.name": "user1"
                        }
                      },
                      {
                        "match": {
                          "cards.tag_categories.tags.is_selected": true
                        }
                      }
  
                    ]
                  }
                }
  
              ]
            }
          }
        }
      },
      {
        "term": {
          "name.keyword": "hello name"
        }
      },
      {
        "term": {
          "title.keyword": "hello title"
        }
      }
  
    ]
     }
    }
  }
  </code></pre>
  
  <p>I have added two child bool queries to match each set of user name and is_selected values. Parent bool query will get the <code>AND</code> and return the document if true. </p>
  
  <p>In the above example query the document should be returned as user1 and user2 match the condition. But it doesn't happen. </p>
  
  <p>If I compare a single user with his is_selected value the document returns. eg: user1. </p>
  
  <p>I will be thankful if anyone can show me where I've made the mistake. </p>