使用es提供的Multi Get API:
使用Multi Get API 可以通过索引名、类型名、文档id一次得到一个文档集合,文档可以来自同一个索引库,也可以来自不同索引库
在Kibana中:
GET /_mget
{
"docs":[
{
"_index":"lib",
"_type":"user",
"_id":1
},
{
"_index": "lib",
"_type": "user",
"_id": 2
}
]
}
可以指定具体的字段:
GET /_mget
{
"docs":[
{
"_index":"lib",
"_type":"user",
"_id":1,
"_source":"interests"
},
{
"_index":"lib",
"_type":"user",
"_id":2,
"_source":["age","interests"]
}
]
}