ElasticSearch(7.2.2)-索引的介绍和使用
- 2019 年 10 月 30 日
- 筆記
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_42528266/article/details/102796160
简介:手把手进行索引的操作
新增
- 请求
curl -X PUT "localhost:9200/nba"
- 响应
{ "acknowledged": true, "shards_acknowledged": true, "index": "nba" }
获取/查询
- 请求
curl -X GET "localhost:9200/nba"
- 响应
{ "nba": { "aliases": {}, "mappings": {}, "settings": { "index": { "creation_date": "1563078001824", "number_of_shards": "1", "number_of_replicas": "1", "uuid": "P-kmcRGlRECcBxAI_8mgaw", "version": { "created": "7020099" }, "provided_name": "nba" } } } }
删除
- 请求
curl -X DELETE "localhost:9200/nba"
- 响应
{ "acknowledged": true }
批量获取
- 请求
curl -x GET "localhost:9200/nba,cba"
- 响应
{ "cba": { "aliases": {}, "mappings": {}, "settings": { "index": { "creation_date": "1563078437245", "number_of_shards": "1", "number_of_replicas": "1", "uuid": "3rGtXSv_QTK-GU_xHKRvmw", "version": { "created": "7020099" }, "provided_name": "cba" } } }, "nba": { "aliases": {}, "mappings": {}, "settings": { "index": { "creation_date": "1563078431931", "number_of_shards": "1", "number_of_replicas": "1", "uuid": "bP6CZH5jSTGlhrTDzlq0bw", "version": { "created": "7020099" }, "provided_name": "nba" } } } }
获取所有
- 请求(一)
curl -X GET "localhost:9200/_all"
- 响应(一)
{ "cba": { "aliases": {}, "mappings": {}, "settings": { "index": { "creation_date": "1563078437245", "number_of_shards": "1", "number_of_replicas": "1", "uuid": "3rGtXSv_QTK-GU_xHKRvmw", "version": { "created": "7020099" }, "provided_name": "cba" } } }, "nba": { "aliases": {}, "mappings": {}, "settings": { "index": { "creation_date": "1563078431931", "number_of_shards": "1", "number_of_replicas": "1", "uuid": "bP6CZH5jSTGlhrTDzlq0bw", "version": { "created": "7020099" }, "provided_name": "nba" } } } }
- 请求(⼆)
curl -X GET "localhost:9200/_cat/indices?v"
- 响应(二)
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size yellow open nba bP6CZH5jSTGlhrTDzlq0bw 1 1 0 0 230b 230b yellow open cba 3rGtXSv_QTK-GU_xHKRvmw 1 1 0 0 230b 230b
存在
- 请求
curl -I "localhost:9200/nba"
- 响应
200 ok
关闭
- 请求
curl -X POST "localhost:9200/nba/_close"
- 响应
{ "acknowledged": true, "shards_acknowledged": true }
打开
- 请求
curl -X POST "localhost:9200/nba/_open"
- 响应
{ "acknowledged": true, "shards_acknowledged": true }