Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/techjacker/elasticsearchquery
Runs queries against AWS elasticsearch deployments
https://github.com/techjacker/elasticsearchquery
aws aws-elasticsearch elasticsearch
Last synced: 27 days ago
JSON representation
Runs queries against AWS elasticsearch deployments
- Host: GitHub
- URL: https://github.com/techjacker/elasticsearchquery
- Owner: techjacker
- Created: 2018-06-03T17:16:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T02:12:42.000Z (almost 2 years ago)
- Last Synced: 2024-09-28T22:42:31.931Z (about 1 month ago)
- Topics: aws, aws-elasticsearch, elasticsearch
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/techjacker/elasticsearchquery.svg?branch=master)](https://travis-ci.org/techjacker/elasticsearchquery)
# AWS Elasticsearch Query
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.
-----------------------------------------------------------
## Example Usage
### Command Line
#### 1. Set required environment variables
```Shell
# .env
export ES_ENDPOINT=https://xxx.xxx.es.amazonaws.com
export ES_REGION=eu-west-1
``````Shell
$ source .env
```#### 2. Create JSON file with your Elasticsearch query to be run
```Shell
# my_es_query.json
{
"query": {
"match": {
}
}
}
```#### 3. Run your query
It will automatically pick up your AWS credentials from your shell's environment.
```Shell
$ elasticsearchquery
$ elasticsearchquery places my_es_query.json
```### Programmatic API
```
from elasticsearchquery import ElasticSearchQueryesQuery = 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()
```
-----------------------------------------------------------
## Unit Tests#### 1. Set Environment
Make a virtual environment and intall the dependencies.
```
$ make env
$ source env/bin/activate
$ make deps
```#### 2. Run Unit Tests
```
$ make test
```