title: How to write a conditional query with Elasticsearch?
body: <p>I have a simple JSON query for Elasticsearch that looks like this:</p>
  
  <pre><code>"query": {
    "bool": {
      "must": { "match": { "id": "1" }} ,
      "must": { "match": { "tags.name": "a1"}}
     }
  }
  </code></pre>
  
  <p>How can I execute the second 'must' criteria ONLY if the value ('a1' in this case) is not empty? </p>