首页 > 编程知识 正文

es如何创建索引库,es怎么建立索引

时间:2023-05-06 05:50:46 阅读:194429 作者:4431

1、首先上图:

2、创建索引【PUT方法】

索引的分片数和副本数为12和0

http://127.0.0.1:9200/demo_comment_message { "settings": { "number_of_shards": 12, "number_of_replicas": 0 }, "mappings": { "properties": { "commentId": { "type": "keyword" }, "desc": { "type": "text" }, "videoId": { "type": "keyword" }, "diggCount": { "type": "integer" }, "createTime": { "type": "long" }, "lastUpdateTime": { "type": "long" } } }}

3、添加索引字段【PUT方法】

http://127.0.0.1:9200/demo_comment_message/_mapping

 

{ "properties": { "type": { "type": "long" } }}

4、删除索引【DELETE方法】--此方法删除所有的索引,谨慎使用

http://127.0.0.1:9200/demo_comment_message { "properties": { "type": { "type": "long" } }}

 

 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。