#!/usr/bin/env python
# coding=utf-8

from elasticsearch import Elasticsearch

es = Elasticsearch("{{ vars['es_server'] }}")

print("Count:\n{}\n".format(es.count()))
print("Info:\n{}\n".format(es.info()))

{% if "query" in vars %}
res = es.search(index="{{ vars['index'] }}", body={"query": { "match": {{ vars['query'] }} }})
print(res)
{% endif %}
