doc的代码如下:
clientMethod: 'mget'
search的代码如下:
clientMethod: 'msearch'
通过查询api可以发现:
client.mget({
body: {
docs: [
{ _index: 'indexA', _type: 'typeA', _id: '1' },
{ _index: 'indexB', _type: 'typeB', _id: '1' },
{ _index: 'indexC', _type: 'typeC', _id: '1' }
]
}
}, function(error, response){
// ...
});
或者
client.mget({
index: 'myindex',
type: 'mytype',
body: {
ids: [1, 2, 3]
}
}, function(error, response){
// ...
});
client.msearch({
body: [
// match all query, on all indices and types
{},
{ query: { match_all: {} } },
// query_string query, on index/mytype
{ _index: 'myindex', _type: 'mytype' },
{ query: { query_string: { query: '"Test 1"' } } }
]
});