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"
        }
    ]
}

猜你喜欢

转载自www.cnblogs.com/wjx-blog/p/12084710.html
今日推荐