Mget操作:

查询多个文档:

curl -XGET 'http://192.168.1.151:9200/_mget' -d '{"docs": [{"_index": "library","_type": "books", "_id": "1"}, {"_index": "library","_type": "books", "_id": "2"}]}'

curl -XGET 'http://192.168.1.151:9200/library/_mget' -d '{"docs": [{"_index": "library","_type": "books", "_id": "1"}, {"_index": "library","_type": "books", "_id": "2"}]}'

ELK 学习笔记之 elasticsearch Mget操作-LMLPHP

查询多个文档的部分字段:

curl -XGET 'http://192.168.1.151:9200/library/_mget' -d '{"docs": [{"_index": "library","_type": "books", "_id": "1", "_source": ["title","price"]}]}'

ELK 学习笔记之 elasticsearch Mget操作-LMLPHP

获取相同index相同type不同id的文档:

curl -XGET 'http://192.168.1.151:9200/library/books/_mget' -d '{"docs": [{"_id": "1"}, {"_id": "2"}]}'

curl -XGET 'http://192.168.1.151:9200/library/books/_mget' -d '{"ids": ["1","2"]}'

ELK 学习笔记之 elasticsearch Mget操作-LMLPHP

05-21 07:15