设置文档类型要在新建一个索引的时候设置。我的elastic是7.6.2
curl -XPUT 'elastic:123456@192.168.1.16:9200/index_v1' -H 'Content-Type: application/json' -d '{ "settings": { "number_of_shards": "1", //分片 "number_of_replicas": "0", //备份节点(如果只有一台测试机器设置成0) "max_result_window": "1000000" }, "mappings": { "properties": { "goods_id": { "type": "long" }, "bn": { "type": "keyword" }, "name": { "type": "text", "analyzer": "ik_smart" }, "name_max_word": { "type": "text", "analyzer": "ik_max_word" }, "name_full": { "type": "keyword" }, "unit": { "type": "keyword" }, "brief": { "type": "text", "analyzer": "ik_smart" }, "marketable": { "type": "keyword" }, "image_default_id": { "type": "keyword" }, "type_id": { "type": "long" }, "cat_id": { "type": "long" }, "brand_id": { "type": "long" }, "cat_name": { "type": "keyword" }, "brand_name": { "type": "keyword" }, "goods_type": { "type": "keyword" }, "mktprice": { "type": "double" }, "weight": { "type": "double" }, "rate": { "type": "double" }, "cost": { "type": "double" }, "udfimg": { "type": "keyword" }, "min_buy": { "type": "long" }, "max_buy": { "type": "long" }, "thumbnail_pic": { "type": "text" }, "package_unit": { "type": "text", "analyzer": "ik_smart" }, "package_scale": { "type": "double" }, "package_use": { "type": "keyword" }, "score_setting": { "type": "keyword" }, "nostore_sell": { "type": "keyword" }, "goods_setting": { "type": "text" } } } }'
在记得原密码的情况下:重置elastic密码:123456
curl -H "Content-Type:application/json" -XPOST -u elastic 'http://127.0.0.1:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "123456" }'