title: Query Vs Filter in Elastic Search
body: <p>I am trying to index a document which has three fields first_name, last_name, occupation of type "keyword" and has values XYZ, ABC, DEF respectively.</p>
  
  <p>I have written query using filter for an exact match with AND condition as follows,</p>
  
  <pre><code>"query": {
    "bool": {
      "filter": [
        {"term": {"first_name": "XYZ"}},
        {"term": {"last_name": "ABC"}}
      ]
    }
  }
  </code></pre>
  
  <p>This has to return one document, but returns nothing.</p>
  
  <p>I have another query for the same operation,</p>
  
  <pre><code>"query": {
    "bool": {
      "must": [
        {"match": {"first_name": "XYZ"}},
        {"match": {"last_name": "ABC"}}
      ]
    }
  }
  </code></pre>
  
  <p>This returns one document.</p>
  
  <p>According to Elasticsearch documentation, I understand that the difference between query and filter is that filter does not score the result. I am not sure why the first query does not return any result. Is my understanding correct?</p>