# Upgrading from ES 1.7 to 5.4; default mapping analyzer

**URL:** <https://discuss.elastic.co/t/upgrading-from-es-1-7-to-5-4-default-mapping-analyzer/94948>\
**Category:** Elasticsearch\
**Created:** [July 28, 2017, 11:54am UTC](https://discuss.elastic.co/t/upgrading-from-es-1-7-to-5-4-default-mapping-analyzer/94948 "2017-07-28T11:54:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karolinebryn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karolinebryn/32/17095_2.png) [@Karolinebryn](https://discuss.elastic.co/u/Karolinebryn)\
**Post date:** [July 28, 2017, 11:54am UTC](https://discuss.elastic.co/t/upgrading-from-es-1-7-to-5-4-default-mapping-analyzer/94948/1 "2017-07-28T11:54:50Z")

</div>

I am in the process of moving our indexes from ES 1.7 to ES 5.4, and I am encountering a problem that I am not sure how to solve.

In my old index I have this mapping on a type:

```
{
  "myType1": {
    "search_analyzer": "default_search_myType1",
    "index_analyzer": "default_index_myType1",
    "properties": {...}
}

```

When I try to create this mapping in ES 5.4, I get the error message that I cannot set analyzer and search\_analyzer on the root of the type.  
So how do I define which analyzer to use for this type?

---

<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:** [July 28, 2017, 12:07pm UTC](https://discuss.elastic.co/t/upgrading-from-es-1-7-to-5-4-default-mapping-analyzer/94948/2 "2017-07-28T12:07:52Z")

</div>

Define it per field instead. You can use a template for that.

---

<div class="post-metadata">

**Author:** ![Karolinebryn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karolinebryn/32/17095_2.png) [@Karolinebryn](https://discuss.elastic.co/u/Karolinebryn)\
**Post date:** [July 28, 2017, 12:18pm UTC](https://discuss.elastic.co/t/upgrading-from-es-1-7-to-5-4-default-mapping-analyzer/94948/3 "2017-07-28T12:18:02Z")

</div>

Do you mean this?  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html)

I also [read](https://www.elastic.co/guide/en/elasticsearch/reference/current/analyzer.html#analyzer) that if you define an analyzer named "default" and/or "default\_search" in your index settings this will be the default analyzer for the index. But this does not seem to work for me...

EDIT: I figured it out 🙂

---

<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:** [July 28, 2017, 12:56pm UTC](https://discuss.elastic.co/t/upgrading-from-es-1-7-to-5-4-default-mapping-analyzer/94948/4 "2017-07-28T12:56:28Z")

</div>

The `default` analyzer works well for me:

```auto
DELETE mytest
PUT mytest
{
  "settings": {
    "analysis": {
      "analyzer": {
        "default": {
          "type": "custom",
          "tokenizer": "keyword"
        }
      }
    }
  }
}

POST mytest/doc
{
  "foo": "FOO BAR"
}

GET mytest/_search
{
  "query": {
    "term": {
      "foo": {
        "value": "FOO BAR"
      }
    }
  }
}

```

This is producing the expected result.

EDIT: just saw that you edited your answer 🙂

---

<div class="post-metadata">

**Author:** ![Karolinebryn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karolinebryn/32/17095_2.png) [@Karolinebryn](https://discuss.elastic.co/u/Karolinebryn)\
**Post date:** [July 28, 2017, 1:29pm UTC](https://discuss.elastic.co/t/upgrading-from-es-1-7-to-5-4-default-mapping-analyzer/94948/5 "2017-07-28T13:29:31Z")

</div>

I solved it by changing the name of the analyzers in the settings to "default" and "default\_search" 🙂

At first I thought it did not work, but when I examined the mappings closed I saw that I had defined "analyzer: standard" on the field I was trying to query... I removed that form the mappings and then everything worked as expected.

Thanks for the help!

---

<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:** [August 25, 2017, 1:29pm UTC](https://discuss.elastic.co/t/upgrading-from-es-1-7-to-5-4-default-mapping-analyzer/94948/6 "2017-08-25T13:29:38Z")

</div>

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