elasticsearch api中的Multi Get API操作
生活随笔
收集整理的這篇文章主要介紹了
elasticsearch api中的Multi Get API操作
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
官網(wǎng):https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-multi-get.html
The multi get API allows to get a list of documents based on their index, type and id:
MultiGetResponse multiGetItemResponses = client.prepareMultiGet().add("twitter", "tweet", "1") .add("twitter", "tweet", "2", "3", "4") .add("another", "type", "foo") .get();for (MultiGetItemResponse itemResponse : multiGetItemResponses) { GetResponse response = itemResponse.getResponse();if (response.isExists()) { String json = response.getSourceAsString(); } }|
| get by a single id |
|
| or by a list of ids for the same index / type |
|
| you can also get from another index |
|
| iterate over the result set |
|
| you can check if the document exists |
|
| access to the _source field |
總結(jié)
以上是生活随笔為你收集整理的elasticsearch api中的Multi Get API操作的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: elasticsearch api中的D
- 下一篇: elasticsearch api中的B