Elasticsearch Connector
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:
Features
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 | ❌ | |
Relationships | ✅ |
Prerequisites
- Create a Hasura Cloud account
- Please ensure you have the DDN CLI and Docker installed
- Create a supergraph
- Create a subgraph
The steps below explain how to initialize and configure a connector on your local machine (typically for development purposes).You can learn how to deploy a connector to Hasura DDN — after it's been configured — here.
Using the Elasticsearch connector
With the context set for an existing subgraph, initialize the connector:
ddn connector init -i
When the wizard runs, you'll be prompted to enter the following env vars necessary for your connector to function:
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 |
|
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* |
After the CLI initializes the connector, you'll need to:
- Introspect the source.
- Add your models, commands, and relationships.
- Create a new build.
- Test it by running your project along with the connector.
Contributing
Check out our contributing guide for more details.
License
The Elasticsearch connector is available under the Apache License 2.0.