标签:pos RKE 修改 cep inf date BMI 分词 async
//为index创建mapping,index相当于mysql的数据库,数据库里的表也要给各个字段创建类型,所以index也要给字段事先设置好类型:
使用postMan或者其他工具创建:(此处我使用postMan,创建一个名为shop的index,type是order-- type相等于mysql的表)
//这里的背景是一个订单表对应多个订单项表(商品信息),然后就将所有的订单和购买的商品信息存到ES,我这里的ES版本是6.4.2
put localthost:9200/shop
{
"mappings": {
"order": {
"dynamic": false,//设置为false的意思就是以后不能动态添加字段
"properties": {
"orderId": {
"type": "keyword", // 字符串类型只有text和keyword,text是会分词
"index": true //如果要以该字段作为搜索条件,就必须写成true
},
"orderAmount": {
"type": "double"
},
"orderTitle": {
"type": "text",
"analyzer": "english"
},
"customerId": {
"type": "keyword",
"index": true
},
"orderSubmit": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd"
},
"payTime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd"
},
"finshiTime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd"
},
"expressAmount": {
"type": "double"
},
"deliveryTime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd"
},
"couponAmount": {
"type": "double"
},
"score": {
"type": "integer"
},
"scoreAmount": {
"type": "double"
},
"orderStatus": {
"type": "integer"
},
"paymentStatus": {
"type": "integer"
},
"markertId": {
"type": "keyword",
"index": true
},
"shopId": {
"type": "keyword",
"index": true
},
"shopName": {
"type": "text",
"analyzer": "english"
},
"address": {
"type": "text",
"analyzer": "standard"
},
"recieveName": {
"type": "text",
"analyzer": "standard"
},
"phone": {
"type": "keyword",
"index": true
}