diff --git a/client/app/assets/images/db-logos/aws_es.png b/client/app/assets/images/db-logos/aws_es.png new file mode 100644 index 0000000000..e26a9c373a Binary files /dev/null and b/client/app/assets/images/db-logos/aws_es.png differ diff --git a/redash/query_runner/amazon_elasticsearch.py b/redash/query_runner/amazon_elasticsearch.py new file mode 100644 index 0000000000..8ea42c05a9 --- /dev/null +++ b/redash/query_runner/amazon_elasticsearch.py @@ -0,0 +1,56 @@ +from .elasticsearch import ElasticSearch +from . import register + +try: + from requests_aws4auth import AWS4Auth + enabled = True +except ImportError: + enabled = False + + +class AmazonElasticsearchService(ElasticSearch): + @classmethod + def name(cls): + return "Amazon Elasticsearch Service" + + @classmethod + def enabled(cls): + return enabled + + @classmethod + def type(cls): + return "aws_es" + + @classmethod + def configuration_schema(cls): + return { + 'type': 'object', + 'properties': { + 'server': { + 'type': 'string', + 'title': 'Endpoint' + }, + 'region': { + 'type': 'string', + }, + 'access_key': { + 'type': 'string', + 'title': 'Access Key' + }, + 'secret_key': { + 'type': 'string', + 'title': 'Secret Key' + } + }, + "secret": ["secret_key"], + "order": ["server", "region", "access_key", "secret_key"], + "required": ['server', 'region', 'access_key', 'secret_key'] + } + + def __init__(self, configuration): + super(AmazonElasticsearchService, self).__init__(configuration) + + self.auth = AWS4Auth(configuration['access_key'], configuration['secret_key'], configuration['region'], 'es') + + +register(AmazonElasticsearchService) diff --git a/redash/query_runner/elasticsearch.py b/redash/query_runner/elasticsearch.py index e9327e504a..25fb26c636 100644 --- a/redash/query_runner/elasticsearch.py +++ b/redash/query_runner/elasticsearch.py @@ -74,7 +74,6 @@ def enabled(cls): def __init__(self, configuration): super(BaseElasticSearch, self).__init__(configuration) - self.syntax = "json" if self.DEBUG_ENABLED: diff --git a/redash/settings/__init__.py b/redash/settings/__init__.py index a54d788022..ee0f7c4782 100644 --- a/redash/settings/__init__.py +++ b/redash/settings/__init__.py @@ -167,6 +167,7 @@ def all_settings(): 'redash.query_runner.url', 'redash.query_runner.influx_db', 'redash.query_runner.elasticsearch', + 'redash.query_runner.amazon_elasticsearch', 'redash.query_runner.presto', 'redash.query_runner.databricks', 'redash.query_runner.hive_ds', diff --git a/requirements_all_ds.txt b/requirements_all_ds.txt index 47fc62a206..0dc951cb6a 100644 --- a/requirements_all_ds.txt +++ b/requirements_all_ds.txt @@ -25,6 +25,7 @@ pymapd>=0.2.1 qds-sdk>=1.9.6 ibm-db>=2.0.9 pydruid==0.4 +requests-aws4auth==0.9 # certifi is needed to support MongoDB and SSL: certifi # We don't install snowflake connector by default, as it's causing conflicts with