根据多个ID批量查询
GET /user/docs/_mget
{
"ids": ["1", "2"]
}
GET /user/docs/_mget
{
"ids": ["1", "2"]
}
查询到数据返回
{
"docs" : [
{
"_index" : "user",
"_type" : "docs",
"_id" : "1",
"_version" : 1,
"_seq_no" : 5,
"_primary_term" : 1,
"found" : true,
"_source" : {
"name" : "王五",
"sex" : 1,
"age" : 25,
"address" : "河北省"
}
},
{
"_index" : "user",
"_type" : "docs",
"_id" : "2",
"_version" : 1,
"_seq_no" : 6,
"_primary_term" : 1,
"found" : true,
"_source" : {
"name" : "王五",
"sex" : 1,
"age" : 25,
"address" : "河北省"
}
}
]
}
{
"docs" : [
{
"_index" : "user",
"_type" : "docs",
"_id" : "1",
"_version" : 1,
"_seq_no" : 5,
"_primary_term" : 1,
"found" : true,
"_source" : {
"name" : "王五",
"sex" : 1,
"age" : 25,
"address" : "河北省"
}
},
{
"_index" : "user",
"_type" : "docs",
"_id" : "2",
"_version" : 1,
"_seq_no" : 6,
"_primary_term" : 1,
"found" : true,
"_source" : {
"name" : "王五",
"sex" : 1,
"age" : 25,
"address" : "河北省"
}
}
]
}
未查询到数据返回
{
"docs" : [
{
"_index" : "user",
"_type" : "docs",
"_id" : "1",
"found" : false
},
{
"_index" : "user",
"_type" : "docs",
"_id" : "2",
"found" : false
}
]
}
{
"docs" : [
{
"_index" : "user",
"_type" : "docs",
"_id" : "1",
"found" : false
},
{
"_index" : "user",
"_type" : "docs",
"_id" : "2",
"found" : false
}
]
}