# When I have a multi-match query, what index analyzer gets applied to the query by default?

**URL:** <https://discuss.elastic.co/t/when-i-have-a-multi-match-query-what-index-analyzer-gets-applied-to-the-query-by-default/235811>\
**Category:** Elasticsearch\
**Created:** [June 4, 2020, 4:21pm UTC](https://discuss.elastic.co/t/when-i-have-a-multi-match-query-what-index-analyzer-gets-applied-to-the-query-by-default/235811 "2020-06-04T16:21:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aorona](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aorona/32/67827_2.png) [@aorona](https://discuss.elastic.co/u/aorona)\
**Post date:** [June 4, 2020, 4:21pm UTC](https://discuss.elastic.co/t/when-i-have-a-multi-match-query-what-index-analyzer-gets-applied-to-the-query-by-default/235811/1 "2020-06-04T16:21:37Z")

</div>

I am using a multi-match query on multi-fields as follows:

INDEX:

```
   "mappings": { "my_doc": { "properties": {
      "content": {
          "type": "text",
              "fields": {
                  "ngram": {
                      "type": "text",
                       "analyzer": "ngram_icu_analyzer"
                   },
                  "norm": {
                       "type": "text",
                       "analyzer": "icu_analyzer"
                   },
                  "phonetic": {
                        "type": "text",
                        "analyzer": "phonetic_analyzer"
                  },
                  "stem": {
                      "type": "text",
                       "analyzer": "stem_analyzer"
                  }
          },
         "analyzer": "preserve_analyzer"
        }
 }}}

```

QUERY:

```
{
    "query": {
        "multi_match" : {
            "query": "this is a test", 
            "fields": ["title^3", "content^3", "title.ngram", "content.ngram"] 
        }
    }
}

```

What analyzer gets applied to which fields on the query? Will there be any analyzer applied? Will it be on a per-field basis? (e.g. for field title.ngram will the ngram\_icu\_analyzer be applied) Will the default analyzer for the field be applied? (preserve\_analyzer).

In other words, do I need to specify a search analyzer in order to control how the query is analyzed?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 4, 2020, 4:35pm UTC](https://discuss.elastic.co/t/when-i-have-a-multi-match-query-what-index-analyzer-gets-applied-to-the-query-by-default/235811/2 "2020-06-04T16:35:51Z")

</div>

> Will it be on a per-field basis?

Yes. I believe so as the `multi_match` generates behind the scene `match` queries for each field (see `best_fields` default option: [Multi-match query | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#type-best-fields)).

> The `best_fields` type generates a [`match` query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html) for each field and wraps them in a [`dis_max`](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-dis-max-query.html) query, to find the single best matching field.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 2, 2020, 4:35pm UTC](https://discuss.elastic.co/t/when-i-have-a-multi-match-query-what-index-analyzer-gets-applied-to-the-query-by-default/235811/3 "2020-07-02T16:35:51Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
