在elasticsearch的索引创建之后,mapping中已经存在的字段不可以修改其定义,但是可以新增字段。新增方式如下:

方式1:使用postman操作

方式2:使用kibana的开发者工具操作

PUT test/_mapping { "properties": { "text": {"type": "text"}, "flag": {"type": "text", "analyzer": "keyword"} } }

方式3:使用curl操作
 

curl -X PUT "localhost:9200/test/_mapping?pretty" -H 'Content-Type: application/json' -d'

{
"properties": {
"alarm_tag_times": {"type": "keyword"},
"alarmTagTimes": {"type": "alias", "path": "alarm_tag_times"},
"flag": {"type": "text"}
}
}
'

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐