其他分享
首页 > 其他分享> > elasticsearch语法之增加字段篇

elasticsearch语法之增加字段篇

作者:互联网

增加字段

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"
          }
      }
    }
  }
}

 

标签:keyword,text,long,REBATE,语法,字段,elasticsearch,MER,type
来源: https://www.cnblogs.com/jwdd/p/15555108.html