Multi GET API介绍
生活随笔
收集整理的這篇文章主要介紹了
Multi GET API介绍
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#先添加幾個文檔
PUT /lib/user/1 {"first_name":"Jane","last_name":"Smith","age":36,"about":"I like to collect rock albums","interests":["music"] }PUT /lib/user/2 {"first_name":"Jane","last_name":"tom","age":38,"about":"I like to collect rock albums","interests":["music"] }?
?獲取
#批量獲取文檔 Multi GET API GET /_mget {"docs":[{"_index":"lib","_type":"user","_id":1},{"_index":"lib","_type":"user","_id":2},{"_index":"lib","_type":"user","_id":3}]}返回信息:
{"docs" : [{"_index" : "lib","_type" : "user","_id" : "1","_version" : 1,"_seq_no" : 7,"_primary_term" : 1,"found" : true,"_source" : {"first_name" : "Jane","last_name" : "Smith","age" : 36,"about" : "I like to collect rock albums","interests" : ["music"]}},{"_index" : "lib","_type" : "user","_id" : "2","_version" : 1,"_seq_no" : 3,"_primary_term" : 1,"found" : true,"_source" : {"first_name" : "Jane","last_name" : "tom","age" : 38,"about" : "I like to collect rock albums","interests" : ["music"]}},{"_index" : "lib","_type" : "user","_id" : "3","found" : false}] }文檔id=1和文檔id=2返回true? 文檔id=3的返回false?因為文檔3沒有添加
獲取文檔指定的字段
#獲取指定字段 GET /_mget {"docs":[{"_index":"lib","_type":"user","_id":1,"_source": "interests"},{"_index":"lib","_type":"user","_id":2,"_source":["interests","age"]}]}獲取結果:
{"docs" : [{"_index" : "lib","_type" : "user","_id" : "1","_version" : 1,"_seq_no" : 7,"_primary_term" : 1,"found" : true,"_source" : {"interests" : ["music"]}},{"_index" : "lib","_type" : "user","_id" : "2","_version" : 1,"_seq_no" : 3,"_primary_term" : 1,"found" : true,"_source" : {"interests" : ["music"],"age" : 38}}] }?
?
?
?
總結
以上是生活随笔為你收集整理的Multi GET API介绍的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MDM9x35MDM9x35启动流程简介
- 下一篇: 大数据技术之kafka (第 3 章 K