elasticsearch7 3修改fielddatatrue时报错types cannot be provided in put mapping requests unless the include_type_name parameter is set to true

  • A+
所属分类:Elasticsearch

---
title: "elasticsearch7.3修改fielddata=true时报错Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true"
date: 2019-08-30 08:02:22
categories: 全文检索
tags:
- true
- elasticsearch
- fielddata
- include_type_name
- parameter
---

报错如下:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."
  },
  "status": 400
}

 

原因是由于写法是低版本的elasticsearch的,高版本要求传入一个include_type_name参数,值为true。所以加上一个参数即可。如下:

PUT /test_index/_mapping/product?include_type_name=true

{

....

}

ZPY

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: