With this connector, Hasura allows you to instantly create a real-time GraphQL API on top of your documents in Elasticsearch. This connector supports Elasticsearch functionalities listed in the table below, allowing for efficient and scalable data operations. Additionally, you will benefit from all the powerful features of Hasura’s Data Delivery Network (DDN) platform, including query pushdown capabilities that delegate all query operations to the Elasticsearch, thereby enhancing query optimization and performance.
This connector is built using the Go Data Connector SDK and implements the Data Connector Spec.
- See the listing in the Hasura Hub
- Hasura DDN Documentation
- Hasura DDN Quickstart
- GraphQL on Elasticsearch
Docs for the Elasticsearch data connector:
Below, you'll find a matrix of all supported features for the Elasticsearch connector:
Feature | Supported | Notes |
---|---|---|
Native Queries + Logical Models | ✅ | |
Simple Object Query | ✅ | |
Filter / Search | ✅ | |
Simple Aggregation | ✅ | |
Sort | ✅ | |
Paginate | ✅ | |
Nested Objects | ✅ | |
Nested Arrays | ✅ | |
Nested Filtering | ✅ | |
Nested Sorting | ❌ | |
Nested Relationships | ❌ |
- Create a Hasura Cloud account
- Please ensure you have the DDN CLI and Docker installed
- Create a supergraph
- Create a subgraph
ddn auth login
Once you have an initialized supergraph and subgraph, run the initialization command in interactive mode while providing a name for the connector in the prompt:
ddn connector init <connector-name> -i
The CLI will ask for a specific port to run the connector on. Choose a port that is not already in use or use the default suggested port.
To configure the connector, the following environment variables need to be set:
Environment Variable | Description | Required | Example Value |
---|---|---|---|
ELASTICSEARCH_URL |
The comma-separated list of Elasticsearch host addresses for connection (Use local.hasura.dev instead of localhost if your connector is running on your local machine) |
Yes | https://example.es.gcp.cloud.es.io:9200 |
ELASTICSEARCH_USERNAME |
The username for authenticating to the Elasticsearch cluster | Yes | admin |
ELASTICSEARCH_PASSWORD |
The password for the Elasticsearch user account | Yes | default |
ELASTICSEARCH_API_KEY |
The Elasticsearch API key for authenticating to the Elasticsearch cluster | No | ABCzYWk0NEI0aDRxxxxxxxxxx1k6LWVQa2gxMUpRTUstbjNwTFIzbGoyUQ== |
ELASTICSEARCH_CA_CERT_PATH |
The path to the Certificate Authority (CA) certificate for verifying the Elasticsearch server's SSL certificate | No | /etc/connector/cacert.pem |
ELASTICSEARCH_INDEX_PATTERN |
The pattern for matching Elasticsearch indices, potentially including wildcards, used by the connector | No | hasura* |
ddn connector introspect <connector-name>
This will generate a configuration.json
file that will have the schema of your Elasticsearch DB.
ddn connector-link add-resources <connector-name>
This command will track all the indices in your Elasticsearch DB as Models.
Check out our contributing guide for more details.
The Elasticsearch connector is available under the Apache License 2.0.