Elasticsearch 7 報錯:
原因:elasticsearch7默認不在支持指定索引類型,默認索引類型是_doc,如果想改變,則配置include_type_name: true 即可(這個沒有測試,官方文檔說的,無論是否可行,建議不要這么做,因為elasticsearch8后就不在提供該字段)。官方文檔:https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html
下面的指令在ES6沒問題:
PUT test_index { "settings":{ "number_of_shards":1, "number_of_replicas":0 }, "mappings":{ "product": { "properties": { "title": {"type": "text"} } } } }
*****product為指定索引類型
ES7必須改為:
PUT test_index { "settings":{ "number_of_shards":1, "number_of_replicas":0 }, "mappings":{ "properties": { "title": {"type": "text"} } } }