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

 

上一篇:关键字、函数和方法 区别


下一篇:自学Python:快速查找文件或文件夹