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.
- HTTP methods (
- 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+
uvpackage 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
POSTorPUT), write the JSON body on the following lines. - Press
Meta+Enter(orEscthenEnter) to submit the multi-line request. - Use
Ctrl+Dto 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf371093e47c7ee88bb1efd287a8cf3ce494b78e23bdcb64959bc76112bb53ab
|
|
| MD5 |
1a2cdfef790ce77b31a66ba58b697768
|
|
| BLAKE2b-256 |
db4af77d8308c05230413f8e3187936e773ae3cd5c6ce9157e6ca7362a8fc021
|
File details
Details for the file elasticsearch_shell-0.1.0-py3-none-any.whl.
File metadata
- Download URL: elasticsearch_shell-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09acb853a2d5880cc5f1898c46bc83f8548921ef3e7e636ddf56754b8b474196
|
|
| MD5 |
3b09bd30947f192c0f437a1709208576
|
|
| BLAKE2b-256 |
3b7518e2d2d8b4ec176165fd8b6adb1778022e7484cb045294979064141fb8b4
|