当前位置: 代码迷 >> 综合 >> elasticsearch6.X 创建index,mapping操作
  详细解决方案

elasticsearch6.X 创建index,mapping操作

热度:56   发布时间:2023-12-29 03:25:18.0

删除index mapping

curl -XDELETE “http://localhost:9200/owner”;
curl -XDELETE “localhost:9200/stealth”;
curl -XDELETE “http://localhost:9200/high_intention”;

创建mapping

index 车主

curl -XPUT “http://localhost:9200/owner”;

mapping

curl -H “Content-Type: application/json” -XPUT “http://localhost:9200/owner/_mapping/owner” -d ‘{“properties”:{“id”:{“type”:“long”,“store”:true},“name”:{“type”:“keyword”,“store”:true},“sex”:{“type”:“keyword”,“store”:true},“age”:{“type”:“integer”,“store”:true},“mobile”:{“type”:“keyword”,“store”:true},“vehicleType”:{“type”:“keyword”},“occupation”:{“type”:“keyword”,“store”:true},“userType”:{“type”:“keyword”,“store”:true},“vin”:{“type”:“keyword”,“store”:true},“address”:{“type”:“keyword”,“store”:true},“education”:{“type”:“keyword”,“store”:true},“familyStatus”:{“type”:“keyword”,“store”:true},“userOrigin”:{“type”:“keyword”,“store”:true},“income”:{“type”:“keyword”,“store”:true},“loanMode”:{“type”:“keyword”,“store”:true},“buyDate”:{“type”:“date”,“store”:true},“buyType”:{“type”:“keyword”,“store”:true}}}’

index 潜客

curl -XPUT “http://localhost:9200/stealth”;
#mapping
curl -H “Content-Type: application/json” -XPUT “http://localhost:9200/stealth/_mapping/stealth” -d ‘{“properties”:{“id”:{id"type":“long”,“store”:true},“name”:{姓名"type":“keyword”,“store”:true},“sex”:{性别"type":“integer”,“store”:true},“age”:{年龄"type":“integer”,“store”:true},“userType”:{用户类型"type":“keyword”,“store”:true},“occupation”:{职业"type":“keyword”,“store”:true},“address”:{省份地区"type":“keyword”,“store”:true},“education”:{学历"type":“keyword”,“store”:true},“mobile”:{手机号"type":“keyword”,“store”:true},“userOrigin”:{用户来源"type":“keyword”,“store”:true},“familyStatus”:{家庭状况"type":“keyword”,“store”:true},“followVehicleType”:{关注车型"type":“keyword”,“store”:true},“attemptCarType”:{有无试驾"type":“boolean”,“store”:true},“buyReason”:{购买原因"type":“keyword”,“store”:true},“carIntention”:{购车意向"type":“keyword”,“store”:true}}}’;

index 高意向

curl -XPUT “http://localhost:9200/high_intention”;

mapping

curl -H “Content-Type: application/json” -XPUT “http://localhost:9200/high_intention/_mapping/high_intention” -d ‘{“properties”:{“id”:{ID"type":“long”,“store”:true},“name”:{“type”:“keyword”,“store”:true},“sex”:{性别"type":“integer”,“store”:true},“age”:{年龄"type":“integer”,“store”:true},“userType”:{用户类型"type":“keyword”,“store”:true},“occupation”:{职业"type":“keyword”,“store”:true},“address”:{省份地区(居住地)“type”:“keyword”,“store”:true},“education”:{学历"type":“keyword”,“store”:true},“mobile”:{手机号"type":“keyword”,“store”:true},“userOrigin”:{用户来源"type":“keyword”,“store”:true},“familyStatus”:{家庭状况"type":“keyword”,“store”:true},“followVehicleType”:{意向车型"type":“keyword”,“store”:true},“attemptCarType”:{有无试驾"type":“keyword”,“store”:true},“buyReason”:{购买原因"type":“keyword”,“store”:true},“orderModel”:{是否下订单"type":“keyword”,“store”:true},“coupon”:{优惠券领取"type":“keyword”,“store”:true}}}’;

  相关解决方案