您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
elasticSearch多索引搜索(不限索引搜索)
发布时间:2021-08-31 22:31:54编辑:雪饮阅读()
在elasticSearch中多索引搜索,你当然可以理解为指定多个索引进行搜索,但是这里主要是指不限制索引进行搜索。
一个请求:
请求正文:none
响应体:
{
"took": 253,
"timed_out": false,
"_shards": {
"total": 4,
"successful": 4,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 3,
"relation": "eq"
},
"max_score": 0.72615415,
"hits": [
{
"_index": "schools",
"_type": "school",
"_id": "1",
"_score": 0.72615415,
"_source": {
"name": "Central School4",
"description": "CBSE Affiliation",
"street": "Nagan",
"city": "paprola",
"state": "HP",
"zip": "176115",
"location": [
31.8955385,
76.8380405
],
"fees": 2004,
"tags": [
"Senior Secondary",
"beautiful campus"
],
"rating": "3.5"
}
},
{
"_index": "my-index-000010",
"_type": "doc",
"_id": "question1",
"_score": 0.18232156,
"_source": {
"name": "Central School1",
"description": "CBSE Affiliation",
"street": "Nagan",
"city": "paprola",
"state": "HP",
"zip": "176115",
"location": [
31.8955385,
76.8380405
],
"fees": 2200,
"tags": [
"Senior Secondary",
"beautiful campus"
],
"rating": "3.3",
"my_join_field": {
"name": "question"
}
}
},
{
"_index": "my-index-000010",
"_type": "doc",
"_id": "answer1",
"_score": 0.18232156,
"_routing": "question1",
"_source": {
"comment": "I am learning ELK",
"username": "Jack",
"name": "Central School",
"my_join_field": {
"name": "answer",
"parent": "question1"
}
}
}
]
}
}
没有看错,这里的响应结果是来自于多个索引的文档,这里只匹配了name为Central的文档,不管这些文档都是来自哪些索引。
关键字词:elasticSearch,多索引,不限索引