docs/integrations/data-integrations/elasticsearch.mdx
This documentation describes the integration of MindsDB with ElasticSearch, a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.. The integration allows MindsDB to access data from ElasticSearch and enhance ElasticSearch with AI capabilities.
Before proceeding, ensure the following prerequisites are met:
Establish a connection to ElasticSearch from MindsDB by executing the following SQL command and providing its handler name as an engine.
CREATE DATABASE elasticsearch_datasource
WITH ENGINE = 'elasticsearch',
PARAMETERS={
'cloud_id': 'xyz', -- optional, if hosts are provided
'hosts': 'https://xyz.xyz.gcp.cloud.es.io:123', -- optional, if cloud_id is provided
'api_key': 'xyz', -- optional, if user and password are provided
'user': 'elastic', -- optional, if api_key is provided
'password': 'xyz' -- optional, if api_key is provided
};
The connection parameters include the following:
cloud_id: The Cloud ID provided with the ElasticSearch deployment. Required only when hosts is not provided.hosts: The ElasticSearch endpoint provided with the ElasticSearch deployment. Required only when cloud_id is not provided.api_key: The API key that you generated for the ElasticSearch deployment. Required only when user and password are not provided.user and password: The user and password used to authenticate. Required only when api_key is not provided.CREATE DATABASE elasticsearch_datasource
WITH ENGINE = 'elasticsearch',
PARAMETERS = {
"hosts": "127.0.0.1:9200",
"user": "user",
"password": "password"
};
Required connection parameters include the following (at least one of these parameters should be provided):
hosts: The IP address and port where ElasticSearch is deployed.user: The user used to autheticate access.password: The password used to autheticate access.
</Tip>
Retrieve data from a specified index by providing the integration name and index name:
SELECT *
FROM elasticsearch_datasource.my_index
LIMIT 10;
For a detailed guide on the limitations of the Elasticsearch SQL API, refer to the official documentation. </Tip>
SELECT query.. operator.This troubleshooting guide provided by Elasticsearch might also be helpful.