IMPORTANT: elasticsearch.js has been replaced by the new Elasticsearch JavaScript client. We strongly advise you to migrate to the new client. To learn more, see the migration guide.
mget
editmget
editclient.mget([params, [callback]])
Get multiple documents based on an index, type (optional) and ids. The body required by mget can take two forms: an array of document locations, or an array of document ids.
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
An array of doc locations. Useful for getting documents from different indices.
const response = await client.mget({ body: { docs: [ { _index: 'indexA', _type: 'typeA', _id: '1' }, { _index: 'indexB', _type: 'typeB', _id: '1' }, { _index: 'indexC', _type: 'typeC', _id: '1' } ] } });
An array of ids. You must also specify the index
and type
that apply to all of the ids.
const response = await client.mget({ index: 'myindex', type: 'mytype', body: { ids: [1, 2, 3] } });
Params
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|