--------批量获取
通过 mget 获取 多个文档
GET ip:port/_mget -->同时获取
{
'docs':[
{
'_index':'library1',
'_type':'books1',
'_id':1
},
{
'_index':'library1',
'_type':'books2',
'_id':2
},
]
}
GET ip:port/_mget -->同时获取
-->通过_source 获取的字段,如果想要获取多个字段 通过[]定义
{
'docs':[
{
'_index':'library1',
'_type':'books1',
'_id':1
'_source':'name',
},
{
'_index':'library1',
'_type':'books2',
'_id':2,
'_source':'name',
},
]
}
如果在同一个索引同一个TYPE中
条件是id=1,=2,=3
GET ip:port/library/books/_mget
{
'ids':['1','2','3']
}
-------------批量操作
bulk 不能美化展示(不能随意换行,只有最后才能换行)
格式:{action:{metadata}}
action可以是 create update delete index
增 更新 删 增或覆盖
POST ip:port/library/books/_bulk
{'index':{'_id':1}}
{'title':'ES'}
{'index':{'_id':2}}
{'title':'ORC'}
POST ip:port/library/books/_bulk
{'delete':{'_index':'library','_type':'books','_id':1}}
{'create':{'_index':'new1','_type':'table,'_id':'5'}}
{'title';"6不6"}
{'update':{'_index':'library','_type':'books','_id':2}}
{'doc':{'name':'la'}}