# Migrating from ES 5 to ES 8, problems in index

**URL:** <https://discuss.elastic.co/t/migrating-from-es-5-to-es-8-problems-in-index/323454>\
**Category:** Elasticsearch\
**Created:** [January 18, 2023, 7:59pm UTC](https://discuss.elastic.co/t/migrating-from-es-5-to-es-8-problems-in-index/323454 "2023-01-18T19:59:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anibal\_Ardid](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anibal_ardid/32/2660_2.png) [@Anibal\_Ardid](https://discuss.elastic.co/u/Anibal_Ardid)\
**Post date:** [January 18, 2023, 7:59pm UTC](https://discuss.elastic.co/t/migrating-from-es-5-to-es-8-problems-in-index/323454/1 "2023-01-18T19:59:37Z")

</div>

Hi !  
I have this json that i use to index

```auto
{
    "settings":{
        "number_of_shards":1,
        "number_of_replicas":0,
        "index.mapping.total_fields.limit":100000,
        "analysis":{
            "filter":{
                "partial_filter":{
                    "type":"edge_ngram",
                    "min_gram":2,
                    "max_gram":20,
                    "token_chars":[
                        "letter",
                        "digit"
                    ]
                }
            },
            "analyzer":{
                "partial-match":{
                    "type":"custom",
                    "tokenizer":"standard",
                    "filter":[
                        "lowercase",
                        "asciifolding",
                        "partial_filter"
                    ]
                },
                "exact-match":{
                    "type":"custom",
                    "tokenizer":"standard",
                    "filter":[
                        "lowercase",
                        "asciifolding"
                    ]
                },
                "last-name":{
                    "type":"custom",
                    "tokenizer":"keyword",
                    "filter":[
                        "lowercase",
                        "asciifolding"
                    ]
                }
            }
        }
    },
    "mappings":{
        "_default_":{
            "_all":{
                "enabled" : true,
                "type" : "string",
                "analyzer" : "partial-match",
                "search_analyzer" : "standard"
            },
            "dynamic_templates":[
                {
                    "string_template":{
                        "match":"*",
                        "match_mapping_type":"string",
                        "mapping":{
                            "type":"string",
                            "analyzer" : "partial-match",
                            "search_analyzer" : "standard",
                            "fields":{
                                "{name}":{
                                    "type":"text",
                                    "index":"analyzed",
                                    "analyzer":"partial-match",
                                    "search_analyzer":"standard"
                                },
                                "exact-match":{
                                    "type":"string",
                                    "index":"analyzed",
                                    "analyzer":"exact-match",
                                    "search_analyzer":"exact-match"
                                }
                            }
                        }
                    }
                }
            ],
            "properties":{
                "post_title":{
                    "type":"text",
                    "analyzer" : "partial-match",
                    "search_analyzer" : "standard",
                    "fields":{
                        "sort-order":{
                            "type":"string",
                            "fielddata": true,
                            "index":"analyzed",
                            "analyzer":"last-name",
                            "search_analyzer":"last-name"
                        }
                    }
                },
                "date":{
                    "type":"date",
                    "format":"yyyy-MM-dd HH:mm:ss"
                },
                "orderby_date":{
                    "type":"date",
                    "format":"yyyy-MM-dd HH:mm:ss"
                },
                "post_status":{
                    "type":"string",
                    "index":"not_analyzed"
                },
                "visible":{
                    "type":"boolean",
                    "index":"not_analyzed"
                },
                "people":{
                    "type":"nested",
                    "properties":{
                        "id":{
                            "type":"integer",
                            "index":"not_analyzed"
                        },
                        "post_title":{
                            "type":"string",
                            "index":"not_analyzed"
                        }
                    }
                },
                "practice_area":{
                    "type":"nested",
                    "properties":{
                        "id":{
                            "type":"integer",
                            "index":"not_analyzed"
                        },
                        "post_title":{
                            "type":"string",
                            "index":"not_analyzed"
                        }
                    }
                },
                "industry":{
                   "type":"nested",
                    "properties":{
                        "id":{
                            "type":"integer",
                            "index":"not_analyzed"
                        },
                        "post_title":{
                            "type":"string",
                            "index":"not_analyzed"
                        }
                    }
                },
                "news_item_type":{
                    "type":"nested",
                    "properties":{
                        "id":{
                            "type":"integer",
                            "index":"not_analyzed"
                        },
                        "term":{
                            "type":"string",
                            "index":"not_analyzed"
                        }
                    }
                },
                "publication_type":{
                    "type":"nested",
                    "properties":{
                        "id":{
                            "type":"integer",
                            "index":"not_analyzed"
                        },
                        "term":{
                            "type":"string",
                            "index":"not_analyzed"
                        }
                    }
                },
                "position":{
                    "type":"nested",
                    "properties":{
                        "id":{
                            "type":"integer",
                            "index":"not_analyzed"
                        },
                        "term":{
                            "type":"string",
                            "index":"not_analyzed"
                        }
                    }
                },
                "office_location":{
                    "type":"nested",
                    "properties":{
                        "id":{
                            "type":"integer",
                            "index":"not_analyzed"
                        },
                        "post_title":{
                            "type":"string",
                            "index":"not_analyzed"
                        }
                    }
                },
                "bar_memberships_fieldset":{
                    "type":"nested",
                    "properties":{
                        "bar_admission":{
                            "type":"nested",
                            "properties":{
                                "id":{
                                    "type":"integer",
                                    "index":"not_analyzed"
                                },
                                "term":{
                                    "type":"string",
                                    "index":"not_analyzed"
                                }
                            }
                        }
                    }
                },
                "education_fieldset":{
                    "type":"nested",
                    "properties":{
                        "law_school":{
                            "type":"string",
                            "index":"not_analyzed"
                        },
                        "school":{
                            "type":"nested",
                            "properties":{
                                "id":{
                                    "type":"integer",
                                    "index":"not_analyzed"
                                },
                                "term":{
                                    "type":"string",
                                    "index":"not_analyzed"
                                }
                            }
                        }
                    }
                },
                "languages_fieldset":{
                    "type":"nested",
                    "properties":{
                        "id":{
                            "type":"integer",
                            "index":"not_analyzed"
                        },
                        "term":{
                            "type":"string",
                            "index":"not_analyzed"
                        }
                    }
                },
                "parent_blog":{
                    "type": "nested",
                    "properties":{
                        "id":{
                            "type":"integer",
                            "index":"not_analyzed"
                        }
                    }    
                }
            }
        },
        "person":{
            "properties":{
                "last_name":{
                    "type":"text",
                    "analyzer" : "partial-match",
                    "search_analyzer" : "standard",
                    "fields":{
                        "raw":{
                            "type":"string",
                            "index":"not_analyzed"
                        },
                        "sort-order":{
                            "type":"string",
                            "fielddata": true,
                            "index":"analyzed",
                            "analyzer":"last-name",
                            "search_analyzer":"last-name"
                        },
                        "exact-match":{
                            "type":"string",
                            "index":"analyzed",
                            "analyzer":"exact-match",
                            "search_analyzer":"exact-match"
                        }
                    }
                },
                "first_name":{
                    "type":"text",
                    "analyzer" : "partial-match",
                    "search_analyzer" : "standard",
                    "fields":{
                        "raw":{
                            "type":"string",
                            "index":"not_analyzed"
                        },
                        "sort-order":{
                            "type":"string",
                            "fielddata": true,
                            "index":"analyzed",
                            "analyzer":"last-name",
                            "search_analyzer":"last-name"
                        },
                        "exact-match":{
                            "type":"string",
                            "index":"analyzed",
                            "analyzer":"exact-match",
                            "search_analyzer":"exact-match"
                        }
                    }
                }
            }
        }
    }
}

```

I changed to (removing _default_, not\_analyzed,changing string to keyword):

```auto
{
    "settings":{
        "number_of_shards":1,
        "number_of_replicas":0,
        "index.mapping.total_fields.limit":100000,
        "analysis":{
            "filter":{
                "partial_filter":{
                    "type":"edge_ngram",
                    "min_gram":2,
                    "max_gram":20,
                    "token_chars":[
                        "letter",
                        "digit"
                    ]
                }
            },
            "analyzer":{
                "partial-match":{
                    "type":"custom",
                    "tokenizer":"standard",
                    "filter":[
                        "lowercase",
                        "asciifolding",
                        "partial_filter"
                    ]
                },
                "exact-match":{
                    "type":"custom",
                    "tokenizer":"standard",
                    "filter":[
                        "lowercase",
                        "asciifolding"
                    ]
                },
                "last-name":{
                    "type":"custom",
                    "tokenizer":"keyword",
                    "filter":[
                        "lowercase",
                        "asciifolding"
                    ]
                }
            }
        }
    },
    "mappings":{
        "_all":{
            "enabled" : true,
            "type" : "string",
            "analyzer" : "partial-match",
            "search_analyzer" : "standard"
        },
        "dynamic_templates":[
            {
                "string_template":{
                    "match":"*",
                    "match_mapping_type":"string",
                    "mapping":{
                        "type":"keyword",
                        "analyzer" : "partial-match",
                        "search_analyzer" : "standard",
                        "fields":{
                            "{name}":{
                                "type":"text",
                                "index":"analyzed",
                                "analyzer":"partial-match",
                                "search_analyzer":"standard"
                            },
                            "exact-match":{
                                "type":"keyword",
                                "index":"analyzed",
                                "analyzer":"exact-match",
                                "search_analyzer":"exact-match"
                            }
                        }
                    }
                }
            }
        ],
        "properties":{
            "post_title":{
                "type":"text",
                "analyzer" : "partial-match",
                "search_analyzer" : "standard",
                "fields":{
                    "sort-order":{
                        "type":"keyword",
                        "fielddata": true,
                        "index":"analyzed",
                        "analyzer":"last-name",
                        "search_analyzer":"last-name"
                    }
                }
            },
            "date":{
                "type":"date",
                "format":"yyyy-MM-dd HH:mm:ss"
            },
            "orderby_date":{
                "type":"date",
                "format":"yyyy-MM-dd HH:mm:ss"
            },
            "post_status":{
                "type":"keyword"
            },
            "visible":{
                "type":"boolean"
            },
            "people":{
                "type":"nested",
                "properties":{
                    "id":{
                        "type":"integer"
                    },
                    "post_title":{
                        "type":"keyword"
                    }
                }
            },
            "practice_area":{
                "type":"nested",
                "properties":{
                    "id":{
                        "type":"integer"
                    },
                    "post_title":{
                        "type":"keyword"
                    }
                }
            },
            "industry":{
               "type":"nested",
                "properties":{
                    "id":{
                        "type":"integer"
                    },
                    "post_title":{
                        "type":"keyword"
                    }
                }
            },
            "news_item_type":{
                "type":"nested",
                "properties":{
                    "id":{
                        "type":"integer"
                    },
                    "term":{
                        "type":"keyword"
                    }
                }
            },
            "publication_type":{
                "type":"nested",
                "properties":{
                    "id":{
                        "type":"integer"
                    },
                    "term":{
                        "type":"keyword"
                    }
                }
            },
            "position":{
                "type":"nested",
                "properties":{
                    "id":{
                        "type":"integer"
                    },
                    "term":{
                        "type":"keyword"
                    }
                }
            },
            "office_location":{
                "type":"nested",
                "properties":{
                    "id":{
                        "type":"integer"
                    },
                    "post_title":{
                        "type":"keyword"
                    }
                }
            },
            "bar_memberships_fieldset":{
                "type":"nested",
                "properties":{
                    "bar_admission":{
                        "type":"nested",
                        "properties":{
                            "id":{
                                "type":"integer"
                            },
                            "term":{
                                "type":"keyword"
                            }
                        }
                    }
                }
            },
            "education_fieldset":{
                "type":"nested",
                "properties":{
                    "law_school":{
                        "type":"keyword"
                    },
                    "school":{
                        "type":"nested",
                        "properties":{
                            "id":{
                                "type":"integer"
                            },
                            "term":{
                                "type":"keyword"
                            }
                        }
                    }
                }
            },
            "languages_fieldset":{
                "type":"nested",
                "properties":{
                    "id":{
                        "type":"integer"
                    },
                    "term":{
                        "type":"keyword"
                    }
                }
            },
            "parent_blog":{
                "type": "nested",
                "properties":{
                    "id":{
                        "type":"integer"
                    }
                }    
            }
        },
        "person":{
            "properties":{
                "last_name":{
                    "type":"text",
                    "analyzer" : "partial-match",
                    "search_analyzer" : "standard",
                    "fields":{
                        "raw":{
                            "type":"keyword"
                        },
                        "sort-order":{
                            "type":"keyword",
                            "fielddata": true,
                            "index":"analyzed",
                            "analyzer":"last-name",
                            "search_analyzer":"last-name"
                        },
                        "exact-match":{
                            "type":"keyword",
                            "index":"analyzed",
                            "analyzer":"exact-match",
                            "search_analyzer":"exact-match"
                        }
                    }
                },
                "first_name":{
                    "type":"text",
                    "analyzer" : "partial-match",
                    "search_analyzer" : "standard",
                    "fields":{
                        "raw":{
                            "type":"keyword"
                        },
                        "sort-order":{
                            "type":"keyword",
                            "fielddata": true,
                            "index":"analyzed",
                            "analyzer":"last-name",
                            "search_analyzer":"last-name"
                        },
                        "exact-match":{
                            "type":"keyword",
                            "index":"analyzed",
                            "analyzer":"exact-match",
                            "search_analyzer":"exact-match"
                        }
                    }
                }
            }
        }
    }
}

```

And I have this error:

```auto
  [Elasticsearch\Common\Exceptions\BadRequest400Exception]
  {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"unknown parameter [search_analyzer] on mapper [sort-order] of type [keyword]"}],"type":"mapper_parsing_e
  xception","reason":"Failed to parse mapping: unknown parameter [search_analyzer] on mapper [sort-order] of type [keyword]","caused_by":{"type":"mapper_parsing_exception","re
  ason":"unknown parameter [search_analyzer] on mapper [sort-order] of type [keyword]"}},"status":400}

```

I'm using the latest elasticsearch php composer library.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Anibal\_Ardid](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anibal_ardid/32/2660_2.png) [@Anibal\_Ardid](https://discuss.elastic.co/u/Anibal_Ardid)\
**Post date:** [January 18, 2023, 8:01pm UTC](https://discuss.elastic.co/t/migrating-from-es-5-to-es-8-problems-in-index/323454/2 "2023-01-18T20:01:42Z")

</div>

I tried also without `_all_`

---

<div class="post-metadata">

**Author:** ![Anibal\_Ardid](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anibal_ardid/32/2660_2.png) [@Anibal\_Ardid](https://discuss.elastic.co/u/Anibal_Ardid)\
**Post date:** [January 24, 2023, 6:57pm UTC](https://discuss.elastic.co/t/migrating-from-es-5-to-es-8-problems-in-index/323454/3 "2023-01-24T18:57:41Z")

</div>

nothing knows about it ? ☹

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [January 24, 2023, 8:20pm UTC](https://discuss.elastic.co/t/migrating-from-es-5-to-es-8-problems-in-index/323454/4 "2023-01-24T20:20:01Z")

</div>

The format of the templates changed in version 8, you need to adapt your templates according to the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html).

From version 5 to version 8 a lot of things changed, you will need to check every breaking change from your current version 5 until the last 8 version to see what you will need to change.

---

<div class="post-metadata">

**Author:** ![Anibal\_Ardid](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anibal_ardid/32/2660_2.png) [@Anibal\_Ardid](https://discuss.elastic.co/u/Anibal_Ardid)\
**Post date:** [January 26, 2023, 2:17pm UTC](https://discuss.elastic.co/t/migrating-from-es-5-to-es-8-problems-in-index/323454/5 "2023-01-26T14:17:51Z")

</div>

Hola Leandro !  
Hi !  
But, this change a lot of things, i checked and changed some, but i have fails that i couldnt recognize where is the problem

---

<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:** [February 23, 2023, 2:18pm UTC](https://discuss.elastic.co/t/migrating-from-es-5-to-es-8-problems-in-index/323454/6 "2023-02-23T14:18:34Z")

</div>

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