Skip to content

Instantly share code, notes, and snippets.

@isears-dds
isears-dds / scrolling_queries.py
Last active July 12, 2023 20:53
Elasticsearch scrolling query fuction
import elasticsearch
def scroll_query(es, index, query):
"""
:param es: an elasticsearch client object created with elasticsearch.Elasticsearch()
:param index: the name of the log to query (e.g. 'conn', 'timetohello', etc.)
:param query: elasticsearch query (docs on elastic.co)
:return: iterator containing results of elastic query