import time


def runner(es, query, time_in_secs=60):
    """
    Start by clearing the cache. Then, run query until we hit or exceed ``time_in_secs``.
    
    Displays a plot of query time and returns some stats about them.
    """
    results = []

    es.indices.clear_cache('wiki-test')
    
    time_start = time.time()

    while (time.time() - time_start) < time_in_secs:
        r = es.search(index='wiki-test', body=query)
        results.append(r['took'])
    
    results = sorted(results)

    return results