使用新映射更新Elasticsearch 5.6索引类型

时间:2019-06-03 14:31:49

标签: elasticsearch elasticsearch-5

我想向已有的索引添加新映射,我正在尝试

curl -H 'Content-Type: application/json' -H 'Accept: application/json' -X PUT http://localhost:9200/videos_development/_mapping/video -d '
"video":{
  "properties":{
    "id_lookup":"text"
   }
 }
'

但它正在返回

{"error":{"root_cause":[{"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}],"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"},"status":500}%

我真的不知道这意味着什么...

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

您的JSON格式不正确,您需要打开和关闭花括号,而且在字段定义中也缺少type

curl -H 'Content-Type: application/json' -H 'Accept: application/json' -X PUT http://localhost:9200/videos_development/_mapping/video -d '{
 "video":{
   "properties":{
     "id_lookup": {
       "type": "text"
     }
   }
  }
}'