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"}]}'
查询多个文档的部分字段:
curl -XGET 'http://192.168.1.151:9200/library/_mget' -d '{"docs": [{"_index": "library","_type": "books", "_id": "1", "_source": ["title","price"]}]}'
获取相同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"]}'