Use the Elastic CLI from KosmoKrator to call Elastic tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.
7 functions5 read2 writeUsername and password auth
Elastic can be configured headlessly with `kosmokrator integrations:configure elastic`.
# Install KosmoKrator first if it is not available on PATH.curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash# Configure and verify this integration.kosmokrator integrations:configure elastic --enable --read allow --write ask --jsonkosmokrator integrations:doctor elastic --jsonkosmokrator integrations:status --json
Credentials
Authentication type: Username and passwordbasic. Configure credentials once, then use the same stored profile from
scripts, coding CLIs, Lua code mode, and the MCP gateway.
Key
Env var
Type
Required
Label
api_key
ELASTIC_API_KEY
Secret secret
no
API Key
username
ELASTIC_USERNAME
Text string
no
Username
password
ELASTIC_PASSWORD
Secret secret
no
Password
url
ELASTIC_URL
URL url
no
Elasticsearch URL
Call Elastic Headlessly
Use the generic call form when another coding CLI or script needs a stable universal interface.
Every function below can be called headlessly. The generic form is stable across all integrations;
the provider shortcut is shorter but specific to Elastic.
elastic.elastic_list_indices
Read read
List all indices in the Elasticsearch cluster. Returns index names, health status, document counts, and sizes.
Create or update a document in an Elasticsearch index. Provide an ID to update an existing document, or omit it to let Elasticsearch auto-generate one.
The Elasticsearch query object. Example: {"match": {"title": "search term"}}. Defaults to match_all if omitted.
size
integer
no
Maximum number of results to return (default: 10).
from
integer
no
Starting offset for pagination (default: 0).
elastic.elastic_index_document
Create or update a document in an Elasticsearch index. Provide an ID to update an existing document, or omit it to let Elasticsearch auto-generate one.
Headless calls still follow the integration read/write permission policy. Configure read/write defaults
with integrations:configure. Add --force only for trusted automation that should bypass that policy.