增加字段
PUT 环境.merchant_2/_mapping/_doc?include_type_name=true { "properties": { "REBATE_STATUS":{ "type":"text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "REBATE_MER_NAME":{ "type":"text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "REBATE_MER_PROVINCE":{ "type":"text" }, "REBATE_MER_CITY":{ "type":"text" }, "REBATE_MER_COUNTY":{ "type":"text" }, "REBATE_MER_INVITEEID":{ "type":"text" }, "TORE_COVER_URL":{ "type":"text" }, "BUSINESS_DISTRICT":{ "type":"text" }, "UNIT_PRICE":{ "type":"long" }, "AVERAGE_PRICE":{ "type":"long" }, "ONE_BUSINESS_TYPE":{ "type":"text" }, "TURNOVER":{ "type":"long" }, "COMMISSION_AMOUNT":{ "type":"long" }, "REBATE_CREATE_STAMP":{ "type":"date", "format": "yyyy-MM-dd HH:mm:ss" }, "LOCATION":{ "type":"geo_point" } } }
设置默认值
POST 环境.merchant_2/_update_by_query
{
"script":{
"lang":"painless",
"source":"ctx._source.TURNOVER = 0"
},
"query":{
"bool": {
"must_not": {
"exists": {
"field": "TURNOVER"
}
}
}
}
}
想要了解更多精彩内容,请跳转官方文档查看
https://www.elastic.co/guide/cn/elasticsearch/guide/current/getting-started.html