Multi GET API介绍
GET /lib/user/_mget
{"docs":[{"_id":1},{"_type":"user","_id":2}]
}
#返回值
{"docs" : [{"_index" : "lib","_type" : "user","_id" : "1","_version" : 1,"_seq_no" : 7,"_primary_term" : 1,"found" : true,"_source" : {"first_name" : "Jane","last_name" : "Smith","age" : 36,"about" : "I like to collect rock albums","interests" : ["music"]}},{"_index" : "lib","_type" : "user","_id" : "2","_version" : 1,"_seq_no" : 3,"_primary_term" : 1,"found" : true,"_source" : {"first_name" : "Jane","last_name" : "tom","age" : 38,"about" : "I like to collect rock albums","interests" : ["music"]}}]
}
更简单的:
GET /lib/user/_mget
{"ids":["1","2","3"]
}
返回结果:
{"docs" : [{"_index" : "lib","_type" : "user","_id" : "1","_version" : 1,"_seq_no" : 7,"_primary_term" : 1,"found" : true,"_source" : {"first_name" : "Jane","last_name" : "Smith","age" : 36,"about" : "I like to collect rock albums","interests" : ["music"]}},{"_index" : "lib","_type" : "user","_id" : "2","_version" : 1,"_seq_no" : 3,"_primary_term" : 1,"found" : true,"_source" : {"first_name" : "Jane","last_name" : "tom","age" : 38,"about" : "I like to collect rock albums","interests" : ["music"]}},{"_index" : "lib","_type" : "user","_id" : "3","found" : false}]
}