title: Elastic Search "must" in array
body: <p>I'm a newbie with Elastic Search.</p>
  
  <p>I've got the next object indexed in elasticsearch:</p>
  
  <pre><code>                "doc": [
                      {
                          "partes": [
                              {
                                  "algo": [
                                      {
                                          "Category": "Therapeutic or Preventive Procedure",
                                          "Neg": "false",
                                          "CandidatePreferred": "Obstetric Surgical Procedures",
                                          "CandidateScore": "1000",
                                          "CandidateMatched": "Obstetric Surgical",
                                          "Phrase": "OBSTETRIC SURGICAL",
                                          "CUI": "C0038906"
                                      }
                                  ]
                              }
                          ]
                      },
                      {
                          "partes": [
                              {
                                  "algo": [
                                      {
                                          "Category": "Intellectual Product",
                                          "Neg": "false",
                                          "CandidatePreferred": "Given name",
                                          "CandidateScore": "790",
                                          "CandidateMatched": "given",
                                          "Phrase": "given of discharge",
                                          "CUI": "C3244317"
                                      },
                                      {
                                          "Category": "Body Substance",
                                          "Neg": "false",
                                          "CandidatePreferred": "Discharge, body substance",
                                          "CandidateScore": "790",
                                          "CandidateMatched": "Discharge",
                                          "Phrase": "given of discharge",
                                          "CUI": "C2926602"
                                      }
                                  ]
                              },
                              {
                                  "algo": [
                                      {
                                          "Category": "Health Care Activity",
                                          "Neg": "false",
                                          "CandidatePreferred": "Patient Discharge",
                                          "CandidateScore": "790",
                                          "CandidateMatched": "Discharge",
                                          "Phrase": "given of discharge",
                                          "CUI": "C0030685"
                                      },
                                      {
                                          "Category": "Intellectual Product",
                                          "Neg": "false",
                                          "CandidatePreferred": "Given name",
                                          "CandidateScore": "790",
                                          "CandidateMatched": "given",
                                          "Phrase": "given of discharge",
                                          "CUI": "C3244317"
                                      }
                                  ]
                              }
                          ]
                      }
                  ]
              }
          }
  </code></pre>
  
  <p>My objective is get the elements where i have two CUIs in the same element <em>algo</em>, i.e. there is an <strong>algo</strong> in the <strong>doc</strong> who have both CUI's: <em>C3244317</em> and <em>C2926602</em>.</p>
  
  <p>I'm trying to make the next search:</p>
  
  <pre><code>{
      "query": {        
          "nested": {
              "path": "doc",
              "query": {
                  "nested":{
                      "path":"doc.partes",
                      "query": {
                          "nested": {
                              "path":"doc.partes.algo",
                              "query": {
                                  "bool": {
                                      "must": [
                                          { "term": { "doc.partes.algo.CUI": "C3244317" }},
                                          { "term": { "doc.partes.algo.CUI": "C2926602" }}
                                      ]
  
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>But I haven't got any results:</p>
  
  <pre><code>{
      "took": 5,
      "timed_out": false,
      "_shards": {
          "total": 5,
          "successful": 5,
          "failed": 0
      },
      "hits": {
          "total": 0,
          "max_score": null,
          "hits": []
      }
  }
  </code></pre>
  
  <p>I've got results with <em>should</em> instead of <em>must</em>, but it's not the behaviour I've been searching for.</p>