Runs queries against AWS elasticsearch deployments
This library will run your static queries against elasticsearch deployments on AWS. Supply the endpoint plus the local filepath to your JSON file containing the query payload.
Good for lambda functions setting up mappings for AWS elasticsearch deployments.
# .env
export ES_ENDPOINT=https://xxx.xxx.es.amazonaws.com
export ES_REGION=eu-west-1
$ source .env
# my_es_query.json
{
"query": {
"match": {
}
}
}
It will automatically pick up your AWS credentials from your shell’s environment.
$ elasticsearchquery <es_index> <query_filepath>
$ elasticsearchquery places my_es_query.json
from elasticsearchquery import ElasticSearchQuery
esQuery = ElasticSearchQuery(
es_endpoint='https://xxx.xxx.es.amazonaws.com',
index_name='my_index',
query_file='path_to_query.json',
region='eu-west-1',
)
esQuery.run()
Make a virtual environment and intall the dependencies.
$ make env
$ source env/bin/activate
$ make deps
$ make test