Skip to main content

A REPL for Elasticsearch.

Project description

Elasticsearch Shell

A powerful, interactive REPL for Elasticsearch with auto-completion.

Features

  • Auto-completion: Smart suggestions for:
    • HTTP methods (GET, POST, PUT, DELETE)
    • Indices and aliases
    • Common Elasticsearch API endpoints (_search, _cat/indices, etc.)
    • Query DSL keywords inside JSON bodies.
  • Multi-line Editing: Comfortably write and edit complex queries.
  • Persistent History: Your command history is saved across sessions in ~/.local/state/elasticsearch-shell/history.
  • Flexible Connection: Connect to Elasticsearch using Cloud ID and API Key, or via Host, Username, and Password.

Requirements

  • Python 3.13+
  • uv package manager (e.g., pip install uv)

Usage

The recommended way to run the application is with uvx:

uvx elasticsearch-shell

This will download and run the latest version in a temporary virtual environment.

Running from source (for development)

If you have cloned this repository, you can also run the script directly. The script uses uv to manage its dependencies automatically.

First, make the script executable:

chmod +x elasticsearch_shell/elasticsearch_shell.py

Then run it:

./elasticsearch_shell/elasticsearch_shell.py

Alternatively, you can run it with uv without making it executable:

uv run --script elasticsearch_shell/elasticsearch_shell.py

Configuration

Connection to your Elasticsearch cluster is configured via environment variables.

Method 1: Cloud ID and API Key

This is the recommended method for connecting to Elastic Cloud.

export ES_CLOUD_ID="your_cloud_id"
export ES_API_KEY="your_api_key_id:your_api_key_secret"

Method 2: Host, Username, and Password

For self-managed clusters or other connection scenarios.

export ES_HOST="https://your-elasticsearch-host:9200"
export ES_USERNAME="your_username"
export ES_PASSWORD="your_password"

How to Use

Once the shell is running, you can start making requests to Elasticsearch.

  • The first line of your input should be the HTTP method and the path (e.g., GET /_search).
  • For requests with a body (like POST or PUT), write the JSON body on the following lines.
  • Press Meta+Enter (or Esc then Enter) to submit the multi-line request.
  • Use Ctrl+D to exit.

Example

Here's how you would run a search query:

>>> GET /my-index/_search
{
  "query": {
    "match_all": {}
  }
}

(Press Meta+Enter to submit)

The shell will then execute the request and print the JSON response from Elasticsearch.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elasticsearch_shell-0.1.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elasticsearch_shell-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file elasticsearch_shell-0.1.0.tar.gz.

File metadata

  • Download URL: elasticsearch_shell-0.1.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for elasticsearch_shell-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bf371093e47c7ee88bb1efd287a8cf3ce494b78e23bdcb64959bc76112bb53ab
MD5 1a2cdfef790ce77b31a66ba58b697768
BLAKE2b-256 db4af77d8308c05230413f8e3187936e773ae3cd5c6ce9157e6ca7362a8fc021

See more details on using hashes here.

File details

Details for the file elasticsearch_shell-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for elasticsearch_shell-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09acb853a2d5880cc5f1898c46bc83f8548921ef3e7e636ddf56754b8b474196
MD5 3b09bd30947f192c0f437a1709208576
BLAKE2b-256 3b7518e2d2d8b4ec176165fd8b6adb1778022e7484cb045294979064141fb8b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page