0
如何我可以从elasticsearch索引的所有文档,而不确定的尺寸在查询像获取所有文件 - elasticsearch
GET http://localhost:8090/my_index/_search?size=1000&scroll=1m&pretty=true“-d ” {‘大小’:0 “查询”:{ “QUERY_STRING”:{ “MATCH_ALL”:{}}}}
感谢
如何我可以从elasticsearch索引的所有文档,而不确定的尺寸在查询像获取所有文件 - elasticsearch
GET http://localhost:8090/my_index/_search?size=1000&scroll=1m&pretty=true“-d ” {‘大小’:0 “查询”:{ “QUERY_STRING”:{ “MATCH_ALL”:{}}}}
感谢
按照ES scan query documentation,size
参数不是R的只是数量结果:
size参数允许您配置每批结果返回的最大点击次数 。对滚动API 的每个调用都会返回下一批结果,直到 不再有任何结果返回,即匹配数组为空。
检索所有你需要后续调用做的API在上述文件中描述的方式,或使用一些现成的实现,好像有在python的结果。这里是一个示例脚本来转储标准输出结果jsons:
import elasticsearch
from elasticsearch.helpers import scan
import json
es = elasticsearch.Elasticsearch('https://localhost:8090')
es_response = scan(
es,
index='my_index',
doc_type='my_doc_type',
query={"query": { "match_all" : {}}}
)
for item in es_response:
print(json.dumps(item))