#■同时获取多个文档信息
#■例子:获职index:bank和shakespeare下面
#. I0为1.2.3.4.15.6.28的文档信息
GET /bank/bank_account/1
GET /bank/bank_account/2
GET /shakespcare/line/3
GET /bank/bank_account/4
GET /shakespeare/line/15
#日数组[]
GET /_mget
{"docs" : [{"_index" : "bank" ,"_type" : "bank_account","_id" :1},{"_index" : "bank","_type" : "bank_account","_id":2},{"_index" : "shakespeare","_type" : "line","_id" :3},{"index" : "shakespeare" ,"_type" : "line" ,"id":4},{"_index" : "shakespeare","_type" : "line","_id" : 15},{"_index" : "shakespeare","_type" : "line" ,"_id":6},{"_index" : "shakespeare","_type" : "line","_id" :28}]
}
#.也可以指定_source字段,获取你想要的
GET /_mget
{"docs" : [{"_index" : "shakespeare" ,"_type" : 1193,"_id" :6,"source": "play_name"},{"index" : "shakespeare","_type" : "line","_id" :28,"source": "play_nane" }]
}
#.也可以指定多个source字段,数组形式获取你想要的
GET /_mget
{"docs" : [{"_index" : "shakespeare" ,"_type" : 1193,"_id" :6,"source": "play_name"},{"index" : "shakespeare","_type" : "line","_id" :28,"source": ["play_nane","speaker","text_entry" ]}]
}
#.获取相同index相同type下不同ID的文档
GET /shakespeare/1ine/_mget
{
"docs" : [{"_id": 6} ,{"_type" : "line", "_id" :28 }]
}#可以这样简便的写
GET /shakespeare/line/_nget
{
"ids" : ["6", "28" ]
}
GET /shakespeare/line/_mget
{"ids" : ["1", "2", "3", "4", "5", "6", "7" ]}