查询某个索引的信息
用get请求. 如下, 查询shopping索引的信息: http://127.0.0.1:9200/shopping
获取的结果如下
{
"shopping": {
"aliases": {},
"mappings": {},
"settings": {
"index": {
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"number_of_shards": "1",
"provided_name": "shopping",
"creation_date": "1641699865089",
"number_of_replicas": "1",
"uuid": "nBZQnKg2QECccEMNDxpo9w",
"version": {
"created": "7160299"
}
}
}
}
}
查询当前es中所有的索引信息:
http://127.0.0.1:9200/_cat/indices?v
可以看到有我们自己创建的shopping索引的信息, 也有内置的
.geoip_databases
索引信息
执行delete 请求, 请求路径为http://127.0.0.1:9200/shopping
代表删除shopping这个索引 响应如下 ,代表删除成功. 此时如果去执行get请求, 查询索引, 则会报错提示查询的索引不存在.
{
"error": {
"root_cause": [
{
"type": "index_not_found_exception",
"reason": "no such index [shopping]",
"resource.type": "index_or_alias",
"resource.id": "shopping",
"index_uuid": "_na_",
"index": "shopping"
}
],
"type": "index_not_found_exception",
"reason": "no such index [shopping]",
"resource.type": "index_or_alias",
"resource.id": "shopping",
"index_uuid": "_na_",
"index": "shopping"
},
"status": 404
}