您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
elasticSearch获取索引(单个与多个)
发布时间:2021-09-03 22:40:56编辑:雪饮阅读()
获取一个很简单,直接url上面跟上一个索引名称,用get方式获取。
无请求正文
响应正文如:
{
"schools": {
"aliases": {},
"mappings": {
"properties": {
"city": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"description": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"fees": {
"type": "long"
},
"location": {
"type": "float"
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"rating": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"state": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"street": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"tags": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"zip": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"settings": {
"index": {
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"number_of_shards": "1",
"provided_name": "schools",
"creation_date": "1630679580151",
"number_of_replicas": "1",
"uuid": "lvgO0EkkQMuW21PI6sQAtw",
"version": {
"created": "7140099"
}
}
}
}
}
如果用_all代替索引名称,则可以获取所有索引:
或者用*代替索引名称,也是可以获取所有索引:
当然也可以像是这样用逗号分隔的方式去获取指定多个索引:
http://localhost:9200/schools,schools3
关键字词:elasticSearch,获取,索引,单个,多个