title: How to implement an exact match in a filter with elasticsearch?
body: <p>I'm working on a query based on name fields on Elasticsearch 2.4. The fields I'm interested in are: </p>
  
  <ul>
  <li>state</li>
  <li>city</li>
  <li>colony</li>
  </ul>
  
  <p>If I send this query:</p>
  
  <pre><code>    {"query": 
          {"bool" : 
              {"must" : [
                  {"match" : {"state" : {"query" : "michoacán de ocampo", "type" : "boolean"} } }, 
                  {"match" : {"colony" : {"query" : "zamora", "type" : "boolean"} } }, 
                  {"match" : {"city" : {"query" : "zamora", "type" : "boolean"} } } 
              ], 
              "filter" : {"term" : {"state" : "michoacán"} } 
          } 
      } }
  </code></pre>
  
  <p>Results</p>
  
  <pre><code>{
      "_shards": {
          "failed": 0,
          "successful": 5,
          "total": 5
      },
      "hits": {
          "hits": [
              {
                  "_id": "71807",
                  "_index": "my_place",
                  "_score": 8.708784,
                  "_source": {
                      "@timestamp": "2019-11-13T15:34:33.373Z",
                      "@version": "1",
                      "city": "Zamora",
                      "city_id": 828,
                      "colony": "Balcones de Zamora",
                      "id": 71807,
                      "state": "Michoacán de Ocampo",
                      "state_id": 16,
                      "type": "place",
                      "zipcode": "59624",
                      "zone_id": null
                  },
                  "_type": "place"
              },
              {
                  "_id": "71762",
                  "_index": "my_place",
                  "_score": 8.634264,
                  "_source": {
                      "@timestamp": "2019-11-13T15:34:33.112Z",
                      "@version": "1",
                      "city": "Zamora",
                      "city_id": 828,
                      "colony": "Zamora de Hidalgo Centro",
                      "id": 71762,
                      "state": "Michoacán de Ocampo",
                      "state_id": 16,
                      "type": "place",
                      "zipcode": "59600",
                      "zone_id": null
                  },
                  "_type": "place"
              }
          ],
          "max_score": 8.708784,
          "total": 2
      },
      "timed_out": false,
      "took": 5
  }
  </code></pre>
  
  <p>Which are OK</p>
  
  <p>But if I sent the full name of the state in the filter, like this (<strong>note the full name "Michoacán de ocampo" in the filter</strong>)</p>
  
  <pre><code>    {"query": 
          {"bool" : 
              {"must" : [
                  {"match" : {"state" : {"query" : "michoacán de ocampo", "type" : "boolean"} } }, 
                  {"match" : {"colony" : {"query" : "zamora", "type" : "boolean"} } }, 
                  {"match" : {"city" : {"query" : "zamora", "type" : "boolean"} } } 
              ], 
              "filter" : {"term" : {"state" : "Michoacán de Ocampo"} } 
          } 
      } }
  </code></pre>
  
  <p>I got these results:</p>
  
  <pre><code>{
      "_shards": {
          "failed": 0,
          "successful": 5,
          "total": 5
      },
      "hits": {
          "hits": [],
          "max_score": null,
          "total": 0
      },
      "timed_out": false,
      "took": 6
  }
  </code></pre>
  
  <p>I need to send the full name in the filter, how can I achieve this or reconfigure my index in order to have the same results? </p>