New260+ blocks and 240+ tools are now fully documented
DocumentationReferenceCore BlocksDatabases
Block

Elasticsearch Block

Search and manage data in Elasticsearch

The Elasticsearch block lets you integrate Elasticsearch into your workflows. Use it to search documents, index data, retrieve or delete documents, run bulk operations, and list indices — all from a single configurable block.

Overview

PropertyValue
Typeelasticsearch
Categorytools
Color#005571

When to Use

  • Search an index with a JSON query and return matching document hits.
  • Index a single document into an index (create or replace by ID).
  • Retrieve a specific document by its ID.
  • Delete a document from an index by its ID.
  • Bulk-index a batch of documents in one NDJSON request.
  • List all indices available on your Elasticsearch cluster.

Configuration

Operation

Required. Selects which Elasticsearch action the block performs. Every option corresponds directly to a registered tool:

LabelOption ID
Searchelasticsearch_search
Index Documentelasticsearch_index
Get Documentelasticsearch_get
Delete Documentelasticsearch_delete
Bulk Indexelasticsearch_bulk
List Indiceselasticsearch_list_indices

Elasticsearch URL

Required. The base URL of your Elasticsearch cluster, for example https://localhost:9200 or https://my-cluster.es.io:9200.

API Key

Optional. Your Elasticsearch API key used to authenticate requests. Stored as a secret — pass it with {{ELASTICSEARCH_API_KEY}}.

Index

Required. The name of the target index, for example my-index. Visible for all operations except Bulk Index and List Indices.

Query (JSON)

Shown only for the Search operation. A valid Elasticsearch query object in JSON, for example {"match": {"title": "hello"}}.

Document (JSON)

Shown only for the Index Document operation. The document body to store, expressed as a JSON object, for example {"field": "value"}.

Document ID

Shown only for the Get Document and Delete Document operations. The ID of the document to retrieve or delete.

Max Results

Shown only for the Search operation. The maximum number of hits to return (defaults to 10 if left blank).

Inputs & Outputs

Inputs (subBlock ids you can wire from other blocks):

  • operation (string) — Operation to perform; must be one of the option IDs listed above.
  • url (string) — Elasticsearch URL.
  • apiKey (string) — API key for authentication.
  • index (string) — Index name.
  • query (json) — Search query (used by Search operation).
  • document (json) — Document data (used by Index Document operation).
  • id (string) — Document ID (used by Get Document and Delete Document operations).
  • size (string) — Max results (used by Search operation).

Outputs (fields available to downstream blocks via {{elasticsearch_1.field}}):

  • hits (json) — Array of matching documents returned by a search.
  • total (number) — Total number of matching documents.
  • document (json) — Retrieved document (Get Document operation).

Tools

Each operation maps to a dedicated tool registered in the tools registry:

  • Elasticsearch Search (elasticsearch_search) — Executes a POST to /{index}/_search with a JSON query body and returns hits, total, and took (milliseconds).
  • Elasticsearch Index Document (elasticsearch_index) — Creates or replaces a document via POST/PUT to /{index}/_doc/{id?}. Returns id, index, and result (created or updated).
  • Elasticsearch Get Document (elasticsearch_get) — Retrieves a single document by ID via GET /{index}/_doc/{id}. Returns id, index, and source (the document body).
  • Elasticsearch Delete Document (elasticsearch_delete) — Deletes a document by ID via DELETE /{index}/_doc/{id}. Returns id, index, and result (deleted).
  • Elasticsearch Bulk Operations (elasticsearch_bulk) — Performs multiple index, delete, or update operations in a single POST to /_bulk using an NDJSON body. Returns took, errors (boolean), and items (per-operation results).
  • Elasticsearch List Indices (elasticsearch_list_indices) — Lists all indices in the cluster via GET /_cat/indices?format=json. Returns indices (array of index metadata objects).

YAML Example

elasticsearch_1:
  type: elasticsearch
  name: "Elasticsearch"
  inputs:
    operation: "elasticsearch_search"
    url: "https://localhost:9200"
    apiKey: "{{ELASTICSEARCH_API_KEY}}"
    index: "my-index"
    query: '{"match": {"field": "value"}}'
    size: "10"
  connections:
    outgoing:
      - target: next-block-id