Commit a5e93955 authored by 杨林's avatar 杨林

ES操作

parent 41d6a445
## 建库语句
~~~shell
put /goods_v2
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"analysis": {
"analyzer": {
"label_analyzer": {
"type": "pattern",
"pattern": ","
},
"category_analyzer": {
"type": "pattern",
"pattern": "\\"
}
}
}
},
"mappings": {
"properties": {
"platform": {
"type": "integer"
},
"item_id": {
"type": "keyword"
},
"item_name": {
"search_analyzer": "ik_smart",
"similarity": "BM25",
"analyzer": "ik_max_word",
"type": "text"
},
"item_desc": {
"search_analyzer": "ik_smart",
"similarity": "BM25",
"analyzer": "ik_max_word",
"type": "text"
},
"brand_name": {
"type": "keyword"
},
"item_url": {
"type": "keyword"
},
"item_pic_url": {
"type": "keyword"
},
"item_volume": {
"type": "integer"
},
"origin_category": {
"type": "text",
"analyzer": "category_analyzer",
"search_analyzer": "category_analyzer",
"similarity": "BM25"
},
"new_category": {
"type": "text",
"analyzer": "category_analyzer",
"search_analyzer": "category_analyzer",
"similarity": "BM25"
},
"price": {
"type": "double"
},
"coupon_price": {
"type": "double"
},
"commission_rate": {
"type": "double"
},
"coupon_commission": {
"type": "double"
},
"commission_start_time": {
"type": "long"
},
"commission_end_time": {
"type": "long"
},
"coupon_amount": {
"type": "double"
},
"coupon_tips": {
"type": "keyword"
},
"coupon_count": {
"type": "integer"
},
"coupon_remain": {
"type": "integer"
},
"coupon_start_time": {
"type": "long"
},
"coupon_end_time": {
"type": "long"
},
"coupon_link": {
"type": "keyword"
},
"item_label": {
"type": "text",
"analyzer": "label_analyzer",
"search_analyzer": "label_analyzer",
"similarity": "BM25"
},
"shop_id": {
"type": "keyword"
},
"shop_name": {
"type": "keyword"
},
"shop_level": {
"type": "integer"
},
"description_level": {
"type": "double"
},
"express_level": {
"type": "double"
},
"server_level": {
"type": "double"
},
"shop_type": {
"type": "integer"
},
"createTime": {
"type": "long"
}
}
}
}~~~
~~~shell
curl qmbigdata01:9200/goods?pretty \
-X PUT \
-H "Content-Type:application/json" \
-d '{"settings":{"number_of_shards":1,"number_of_replicas":1,"analysis":{"analyzer":{"label_analyzer":{"type":"pattern","pattern":","},"category_analyzer":{"type":"pattern","pattern":"/"}}}},"mappings":{"properties":{"platform":{"type":"integer"},"item_id":{"type":"keyword"},"item_name":{"search_analyzer":"ik_smart","similarity":"BM25","analyzer":"ik_max_word","type":"text"},"item_desc":{"search_analyzer":"ik_smart","similarity":"BM25","analyzer":"ik_max_word","type":"text"},"brand_name":{"type":"keyword"},"item_url":{"type":"keyword"},"item_pic_url":{"type":"keyword"},"item_volume":{"type":"integer"},"origin_category":{"type":"text","analyzer":"category_analyzer","search_analyzer":"category_analyzer","similarity":"BM25"},"new_category":{"type":"text","analyzer":"category_analyzer","search_analyzer":"category_analyzer","similarity":"BM25"},"price":{"type":"double"},"coupon_price":{"type":"double"},"commission_rate":{"type":"double"},"coupon_commission":{"type":"double"},"commission_start_time":{"type":"long"},"commission_end_time":{"type":"long"},"coupon_amount":{"type":"double"},"coupon_tips":{"type":"keyword"},"coupon_count":{"type":"integer"},"coupon_remain":{"type":"integer"},"coupon_start_time":{"type":"long"},"coupon_end_time":{"type":"long"},"coupon_link":{"type":"keyword"},"item_label":{"type":"text","analyzer":"label_analyzer","search_analyzer":"label_analyzer","similarity":"BM25"},"shop_id":{"type":"keyword"},"shop_name":{"type":"keyword"},"shop_level":{"type":"integer"},"description_level":{"type":"double"},"express_level":{"type":"double"},"server_level":{"type":"double"},"shop_type":{"type":"integer"},"createTime":{"type":"long"}}}}'
~~~
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment