在website的index下已經存在一個名為blog的type。想在website下,新增一個名為blog2的type。
執行語句如下:
PUT /website/blog2/1 { "title": "My first blog entry", "text": "Just trying this out...", "date": "2014/01/01" }
報錯信息如下:
{ "error": { "root_cause": [ { "type": "illegal_argument_exception", "reason": "Rejecting mapping update to [website] as the final mapping would have more than 1 type: [blog2, blog]" } ], "type": "illegal_argument_exception", "reason": "Rejecting mapping update to [website] as the final mapping would have more than 1 type: [blog2, blog]" }, "status": 400 }
原因:Elasticsearch 在6.0版本以后,一個index下,只允許創建一個type,不允許存在多個type。並且在官網提供信息,7.0以后不再使用type。