Elasticsearch

Datafly Signal indexes first-party events into Elasticsearch for 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)

  1. Sign up at cloud.elastic.co.
  2. Click Create deployment.
  3. Choose a cloud provider and region.
  4. Select a deployment size based on your expected data volume.
  5. Click Create deployment.
  6. Note the Cloud ID from the deployment overview and the Elasticsearch endpoint URL.

Option B: Self-Hosted

  1. Install Elasticsearch using the official guide.
  2. Ensure the cluster is accessible from your Signal infrastructure.
  3. 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

  1. 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"]
          }
        ]
      }
    }
  }'
  1. The response contains an encoded field — 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

FieldTypeRequiredDescription
addressesstringOne of theseComma-separated list of cluster URLs (e.g. https://es-1:9243,https://es-2:9243). Also accepts a single endpoint value.
cloud_idstringOne of theseThe Elastic Cloud deployment ID. Alternative to addresses for Elastic Cloud deployments.
indexstringYesThe target index name to write documents to.
api_keysecretOne of theseBase64-encoded API key (preferred).
usernamestringOne of theseBasic auth username — use only when API keys aren’t available.
passwordsecretOne of theseBasic auth password.

Signal Setup

Quick Setup

  1. Navigate to Integrations in the sidebar.
  2. Open the Integration Library tab.
  3. Find Elasticsearch or filter by Database.
  4. Click Install, select a variant if available, and fill in the required fields.
  5. 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": {
      "addresses": "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"
  }'

Schema

Each event becomes one indexed document. The recommended mapping (shown in Prerequisites) uses:

FieldMapping typeNotes
event_idkeywordUnique per event. Use as the document _id.
typekeywordEvent type.
eventkeywordEvent name.
anonymous_idkeywordFirst-party visitor identifier.
user_idkeywordLogged-in user identifier (optional).
timestampdateClient event time — use as the index time field.
received_atdateTime Signal received the event.
sent_atdateTime the document was indexed.
contextobjectPage, device, user agent, consent metadata.
propertiesobjectCustom event properties.
traitsobjectUser traits.
source_idkeywordPipeline source identifier.
integration_idkeywordSignal integration identifier.

For high-volume deployments, use a data stream with ILM rollover instead of a single index.

Elasticsearch is a first-party destination under your control. The default blueprint forwards all events. Apply consent filtering via pipeline transforms, ingest pipelines, or filtered Kibana data views over context.consent if needed.

Testing

  1. Enable the integration in Signal and trigger a test event on your website.
  2. In Kibana, go to Discover and select the datafly-events index pattern.
  3. Verify that event documents are appearing with the correct fields.
  4. Or query directly:
curl "https://your-cluster:9200/datafly-events/_search?size=10&sort=timestamp:desc" \
  -H "Authorization: ApiKey YOUR_API_KEY"
  1. In Signal, check the Live Events view to confirm delivery status shows as successful.

Troubleshooting

ProblemSolution
Events not appearing in the indexVerify 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_exceptionThe index does not exist. Create it first, or enable create_index privilege on the API key so it can be auto-created.
Connection timeoutVerify the endpoint URL is correct and accessible from Signal’s network. Check firewall rules.
Mapping conflictsIf fields have different types than expected, check the index mapping. Consider using an index template for consistent mappings.
Cluster health yellow/redCheck 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.

See also