你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
heh2009
赞同来自:
ElastIcPG
yangg
@classmethod def scroll_search(cls, es_url, index, query_json, scroll="5m", search_type='scan', **kwargs): es_client = Elasticsearch(es_url, timeout=settings.ES_TIMEOUT) hits = [] try: resp_json = es_client.search(index=index, body=query_json, pretty=True, scroll=scroll, search_type=search_type, **kwargs) sid = resp_json['_scroll_id'] scroll_size = resp_json["hits"]["total"] while scroll_size > 0: page = es_client.scroll(scroll_id=sid, scroll=scroll) sid = page['_scroll_id'] scroll_size = len(page['hits']['hits']) if scroll_size > 0: hits.extend(page["hits"]["hits"]) return hits except Exception, e: logger.exception(e) return None
要回复问题请先登录或注册
3 个回复
heh2009
赞同来自:
ElastIcPG
赞同来自:
yangg
赞同来自: