赞
踩
环境: 阿里云ElasticSearch 6.7
需求: 给指定索引增加字段
PUT /indexName { "settings": { "number_of_shards": 2, "number_of_replicas": 1 }, "mappings": { "_doc": { "properties": { "id": { "type": "long" }, "name": { "type": "text" }, "picture_url": { "type": "keyword" } } } } }
查看创建好的索引mapping,显示如下:
{ "hello" : { "mappings" : { "_doc" : { "properties" : { "id" : { "type" : "long" }, "name" : { "type" : "text" }, "picture_url" : { "type" : "keyword" } } } } } }
PUT /hello/_doc/_mapping
{
"properties": {
"extendInfo": {
"type": "text"
},
"stock": {
"type": "integer"
}
}
}
再次查看该索引的mapping,发现mapping发生了改变,字段增加上去了。
{ "hello" : { "mappings" : { "_doc" : { "properties" : { "extendInfo" : { "type" : "text" }, "id" : { "type" : "long" }, "name" : { "type" : "text" }, "picture_url" : { "type" : "keyword" }, "stock" : { "type" : "integer" } } } } } }
PUT hello/_doc/_mapping { "properties": { "channelTradeNo": { "type": "keyword", "norms": false, "doc_values": false }, "orderDetails": { "type": "nested", "properties": { "rightsStatus": { "type": "keyword", "norms": false, "doc_values": false }, "rightsCurrTime": { "type": "keyword", "norms": false, "doc_values": false }, "rightsEndTime": { "type": "keyword", "norms": false, "doc_values": false } } } } }
结束语:分享是一种乐趣,你知道的越多,你知道的越少。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。