索引操作
索引操作
创建索引
向ES服务器发PUT请求
http://127.0.0.1:9200/demo
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "demo"
}
查看单个索引
向ES服务器发GET请求
http://127.0.0.1:9200/demo
{
"demo": {
"aliases": {},
"mappings": {},
"settings": {
"index": {
"creation_date": "1632061699362",
"number_of_shards": "1",
"number_of_replicas": "1",
"uuid": "PMskybxnT6WHoA2hWHFETw",
"version": {
"created": "7080099"
},
"provided_name": "demo"
}
}
}
}
查看所有索引
向ES服务器发GET请求
http://127.0.0.1:9200/_cat/indices?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open demo PMskybxnT6WHoA2hWHFETw 1 1 0 0 208b 208b
表头 | 含义 |
---|---|
health | 当前服务器健康状态: |
green: | 集群完整 |
yellow: | 单点正常、集群不完整 |
red: | 单点不正常 |
status | 索引打开、关闭状态 |
index | 索引名 |
uuid | 索引统一编号 |
pri | 主分片数量 |
rep | 副本数量 |
docs.count | 可用文档数量 |
docs.deleted | 文档删除状态(逻辑删除) |
store.size | 主分片和副分片整体占空间大小 |
pri.store.size | 主分片占空间大小 |
删除索引
向ES服务器发DELETE请求
http://127.0.0.1:9200/demo
{
"acknowledged": true
}
本文是原创文章,采用CC BY-NC-SA 4.0协议,完整转载请注明来自耕田日记
评论