LoginSignup
7
4

More than 5 years have passed since last update.

ElasticSearch6.0から複数のmapping_typeが許容されなくなっていた

Posted at

ElasticSearch6.0から色々な制約にチェックが付き始めました。
結構breakingなので5.0の設定を持ってくる場合は注意しましょう。

その変更点の1つに、mapping_typeの将来的な削除があります。
https://www.elastic.co/guide/en/elasticsearch/reference/master/removal-of-types.html

これに伴い、ElasticSearch6.0から複数のmapping_typeの指定でドキュメントが投入された時
以下のようなエラー文言でリクエストが弾かれるようになっています。

error_response
{
 'status': 400, 'error':
 {
  'type': 'illegal_argument_exception',
  'reason': 'Rejecting mapping update to [${index_name}] as the final mapping would have more than 1 type: [${doc_a}, ${doc_b}]' 
 }
}

私はmapping typeとかあまり気にしないでラフに使っていたため
色々なmapping_typeでドキュメントを投入していました。
(web上を見ていると公式ドキュメントで使われいるrestaurant型になっている人が多いんじゃないかな…)

簡単に解決するのであれば、doc typeをすべて同じにしてしまい
過去のindexを削除すればいいと思います。
ES6上の過去のデータを移行する場合はデータのダンプ+リストアになるのかな(未検証)。

7
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
4