Elasticsearch学习笔记之—mget

mget的英文意思是:Multi Get API

允许我们一次get大量的document

mget 查询是基于index,type(可选),id三个条件进行(必须要有index和id

mget不能用来查询

1、不指定索引的使用方式

GET /_mget 
{
    "docs" : [
        {
            "_index" : "test",
            "_type" : "_doc",
            "_id" : "1"
        },
        {
            "_index" : "test",
            "_type" : "_doc",
            "_id" : "2"
        }
    ]
}

2、指定索引的使用方式

GET /test/_mget
{
    "docs" : [
        {
            "_type" : "_doc",
            "_id" : "1"
        },
        {
            "_type" : "_doc",
            "_id" : "2"
        }
    ]
}

 

posted @ 2019-12-23 17:00  星星c#  阅读(476)  评论(0编辑  收藏  举报