Elasticsearch
Datafly Signal delivers events to Elasticsearch for powerful full-text search, real-time analytics, log aggregation, and observability dashboards with Kibana.
Prerequisites
Before configuring Elasticsearch in Signal, you need an Elasticsearch cluster (self-hosted or Elastic Cloud), an index, and an API key for authentication.
Set Up an Elasticsearch Cluster
You have two options:
Option A: Elastic Cloud (Managed)
- Sign up at cloud.elastic.co.
- Click Create deployment.
- Choose a cloud provider and region.
- Select a deployment size based on your expected data volume.
- Click Create deployment.
- Note the Cloud ID from the deployment overview and the Elasticsearch endpoint URL.
Option B: Self-Hosted
- Install Elasticsearch using the official guide.
- Ensure the cluster is accessible from your Signal infrastructure.
- Note the Endpoint URL (e.g.
https://elasticsearch.example.com:9200).
Create an Index
Create an index with an appropriate mapping for event data:
curl -X PUT "https://your-cluster:9200/datafly-events" \
-H "Content-Type: application/json" \
-d '{
"mappings": {
"properties": {
"event_id": { "type": "keyword" },
"type": { "type": "keyword" },
"event": { "type": "keyword" },
"anonymous_id": { "type": "keyword" },
"user_id": { "type": "keyword" },
"timestamp": { "type": "date" },
"received_at": { "type": "date" },
"sent_at": { "type": "date" },
"context": { "type": "object", "enabled": true },
"properties": { "type": "object", "enabled": true },
"traits": { "type": "object", "enabled": true },
"source_id": { "type": "keyword" },
"integration_id": { "type": "keyword" }
}
}
}'Using keyword type for ID fields and date type for timestamps enables efficient filtering and aggregations. The object type for context, properties, and traits allows flexible nested field querying.
Generate an API Key
- In Kibana, go to Stack Management > API Keys > Create API key. Or use the API:
curl -X POST "https://your-cluster:9200/_security/api_key" \
-H "Content-Type: application/json" \
-u "elastic:your_password" \
-d '{
"name": "datafly-signal",
"role_descriptors": {
"datafly_writer": {
"cluster": [],
"index": [
{
"names": ["datafly-events"],
"privileges": ["write", "create_index"]
}
]
}
}
}'- The response contains an
encodedfield — this is the Base64-encoded API key to use in Signal.
Store the API key securely. Create keys with the minimum required privileges (write access to the specific index only).
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
endpoint | string | Yes | The Elasticsearch cluster URL (e.g. https://my-cluster.es.us-east-1.aws.elastic-cloud.com:9243). |
index | string | Yes | The target index name to write documents to. |
api_key | secret | Yes | Base64-encoded API key for authentication. |
cloud_id | string | No | The Elastic Cloud deployment ID. Alternative to endpoint for Elastic Cloud deployments. |
Signal Setup
Quick Setup
- Navigate to Integrations in the sidebar.
- Open the Integration Library tab.
- Find Elasticsearch or filter by Cloud Storage.
- Click Install, select a variant if available, and fill in the required fields.
- Click Install Integration to create the integration with a ready-to-use default blueprint.
API Setup
curl -X POST http://localhost:8084/v1/admin/integration-catalog/elasticsearch/install \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Elasticsearch",
"variant": "default",
"config": {
"endpoint": "https://my-cluster.es.us-east-1.aws.elastic-cloud.com:9243",
"index": "datafly-events",
"api_key": "BASE64_ENCODED_API_KEY"
},
"delivery_mode": "server_side"
}'Testing
- Enable the integration in Signal and trigger a test event on your website.
- In Kibana, go to Discover and select the
datafly-eventsindex pattern. - Verify that event documents are appearing with the correct fields.
- Or query directly:
curl "https://your-cluster:9200/datafly-events/_search?size=10&sort=timestamp:desc" \
-H "Authorization: ApiKey YOUR_API_KEY"- In Signal, check the Live Events view to confirm delivery status shows as successful.
Troubleshooting
| Problem | Solution |
|---|---|
| Events not appearing in the index | Verify the endpoint, index name, and API key are correct. |
Unauthorized (401) | The API key is invalid or has been revoked. Generate a new API key. |
Forbidden (403) | The API key lacks write permission on the index. Create a new key with write privileges on the target index. |
index_not_found_exception | The index does not exist. Create it first, or enable create_index privilege on the API key so it can be auto-created. |
| Connection timeout | Verify the endpoint URL is correct and accessible from Signal’s network. Check firewall rules. |
| Mapping conflicts | If fields have different types than expected, check the index mapping. Consider using an index template for consistent mappings. |
| Cluster health yellow/red | Check cluster health with GET _cluster/health. Yellow means replicas are unassigned; red means primary shards are missing. |
Visit Elasticsearch documentation for full API reference, index lifecycle management, and Kibana dashboard setup.