愚者求师之过,智者从师之长。

elasticsearch 5.x 使用helpers.scan进行深度分页报TransportError

Elasticsearch | 作者 tianchanghai12 | 发布于2017年02月22日 | 阅读数:10317

query={"query" : {"match_all" : {}}}
scanResp= helpers.scan(client= es, query=query, scroll= "10m", index="", doc_type="patent", timeout="10m")

for resp in scanResp:
print "Hiya"

raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, u'illegal_argument_exception', u'No search type for [scan]')

各位前辈有没有遇到过这个问题,在2.x上测试似乎木有问题
已邀请:

medcl - 今晚打老虎。

赞同来自:

No search type for [scan]')  错误提示很明显吧,helpers.scan是哪里的,要更新了,没有这个参数了

penghaoyou5

赞同来自:

看源码可以 
    for res in helpers.scan(es, query=body, index=index, doc_type=doc_type,preserve_order=True):
        print 'res',res
添加参数  preserve_order 解决

要回复问题请先登录注册