All Connectors
Elasticsearch Native Data Connector
Elasticsearch Native Data Connector
Elasticsearch Native Data Connector
The Hasura Elasticsearch Connector allows for connecting to a Elasticsearch search engine, giving you an instant GraphQL API on top of your Elasticsearch data.
About
Version
Released
June 24, 2024
Last Updated
September 5, 2024
GitHub Repo

Elasticsearch Connector

Docs ndc-hub License

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.

Docs for the Elasticsearch data connector:

Features

Below, you'll find a matrix of all supported features for the Elasticsearch connector:

FeatureSupportedNotes
Native Queries + Logical Models
Simple Object Query
Filter / Search
Simple Aggregation
Sort
Paginate
Nested Objects
Nested Arrays
Nested Filtering
Nested Sorting
Nested Relationships

Before you get Started

  1. Create a Hasura Cloud account
  2. Please ensure you have the DDN CLI and Docker installed
  3. Create a supergraph
  4. Create a subgraph

Using the Elasticsearch connector

Step 1: Authenticate your CLI session

ddn auth login

Step 2: Configure the connector

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

Step 2.1: Choose hasura/elasticsearch from the list

Step 2.2: Choose a port for the connector

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.

Step 2.3: Provide the env vars required for the connector

To configure the connector, the following environment variables need to be set:

Environment VariableDescriptionRequiredExample Value
ELASTICSEARCH_URLThe 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)Yeshttps://example.es.gcp.cloud.es.io:9200
ELASTICSEARCH_USERNAMEThe username for authenticating to the Elasticsearch clusterYesadmin
ELASTICSEARCH_PASSWORDThe password for the Elasticsearch user accountYesdefault
ELASTICSEARCH_API_KEYThe Elasticsearch API key for authenticating to the Elasticsearch clusterNo
ABCzYWk0NEI0aDRxxxxxxxxxx1k6LWVQa2gxMUpRTUstbjNwTFIzbGoyUQ==
ELASTICSEARCH_CA_CERT_PATHThe path to the Certificate Authority (CA) certificate for verifying the Elasticsearch server's SSL certificateNo/etc/connector/cacert.pem
ELASTICSEARCH_INDEX_PATTERNThe pattern for matching Elasticsearch indices, potentially including wildcards, used by the connectorNohasura*

Step 3: Introspect the connector

ddn connector introspect <connector-name>

This will generate a configuration.json file that will have the schema of your Elasticsearch DB.

Step 4: Add your resources

ddn connector-link add-resources <connector-name>

This command will track all the indices in your Elasticsearch DB as Models.

Contributing

Check out our contributing guide for more details.

License

The Elasticsearch connector is available under the Apache License 2.0.

2024 Edition

The GraphQL Handbook

A GraphQL Handbook for developers and architects to help plan your GraphQL adoption journey.
The GraphQL Handbook

Ship a rock-solid API on your data – in minutes!