This release is a pre-release and may not be stable for production use.
es_mgmt
Unified Elasticsearch tools library: client construction, waiters, checkpointed list actions, and related helpers.
Overview
- Client:
create_clientwith schema validation - Wait: Health, Exists, Relocate, Restore, Snapshot, Task, ILM phase/step
- Checkpoint: Workbook / Job / Step and
ActionRun - Index actions: open, close, delete, data-stream delete/rollover, settings, shrink, reindex, ILM confirm, …
- Snapshot:
SnapshotTooland snapshot list actions - Reindex:
ReindexTask/ReindexMonitor - Redact:
RedactIlm(clone / apply / confirm) - Docker:
ElasticsearchDockerfor tests - Select:
es_mgmt.selectpattern/alias/query/data_stream/snapshot_indices name lists;PatternFilter+target="snapshot"lists snapshot names - CLI extra:
es-mgmt[cli]Click option kit (es_mgmt.client.cli) - Utils: lists, chunking, config helpers
Installation
From source:
cd /path/to/es-mgmt
uv sync
Quick Start
from es_mgmt.client import create_client
from es_mgmt.checkpoint import ActionRun, EventBus
from es_mgmt.index.actions import OpenIndices
from es_mgmt.wait import Health
client = create_client(
{"elasticsearch": {"client": {"hosts": ["http://localhost:9200"]}}}
)
Health(client).wait()
wb = ActionRun(client, EventBus(), "es-checkpoint").run(
OpenIndices(), ["logs-1", "logs-2"]
)
Modules
Client (es_mgmt.client)
from es_mgmt.client import create_client, ConfigParser, validate_config
config = validate_config(
{"elasticsearch": {"client": {"hosts": ["http://localhost:9200"]}}}
)
client = create_client(config)
Wait (es_mgmt.wait)
from es_mgmt.wait import Exists, Health, IlmPhase, Relocate, Restore, Snapshot, Task
Exists(client, index="my_index").wait()
Health(client, check_type="status").wait()
Task(client, task_id="my_task_id").wait()
Checkpoint (es_mgmt.checkpoint)
from es_mgmt.checkpoint import ActionRun, EventBus
from es_mgmt.index.actions import OpenIndices
run = ActionRun(client, EventBus(), "es-checkpoint")
workbook = run.run(OpenIndices(), ["logs-1", "logs-2"])
# Journal writes: ActionRun(..., persist=True)
Snapshot (es_mgmt.snapshot)
from es_mgmt.snapshot import SnapshotTool
tool = SnapshotTool(client)
tool.snapshot("my_snapshot", repository="my_repo")
Reindex (es_mgmt.reindex)
from es_mgmt.reindex import ReindexTask, ReindexMonitor
task = ReindexTask(client, task_id="abc123")
task.wait_for_completion()
Index (es_mgmt.index)
List actions such as OpenIndices, CloseIndices, DeleteIndices, ConfirmIlmPhase, PromoteIlm.
Run them through ActionRun.
Redact (es_mgmt.redact)
from es_mgmt.redact import RedactIlm
RedactIlm(client, EventBus(), "es-checkpoint").run(source_index, mounted_index)
es_mgmt.redact exports RedactFields.
Cluster (es_mgmt.cluster)
es_mgmt.cluster exports SetClusterRouting.
Select (es_mgmt.select)
from es_mgmt.select import PatternFilter, SelectContext, apply_filters
ctx = SelectContext(client=client, target="index")
names = apply_filters(ctx, [PatternFilter(pattern_kind="prefix", value="logs-")])
Docker (es_mgmt.docker)
ElasticsearchDocker() uses docker.elastic.co/elasticsearch/elasticsearch:9.5.2
by default. Override with ES_MGMT_DOCKER_IMAGE.
from es_mgmt.docker import ElasticsearchDocker
docker = ElasticsearchDocker()
docker.start()
client = docker.get_client()
Utils (es_mgmt.utils)
from es_mgmt.utils import (
chunk_names, ensure_list, get_version,
log_exception, pluralize, redact, to_bool, to_int, to_str,
ConfigManager, load_config, save_config
)
get_version() works only when the es-mgmt distribution is installed.
Testing
cd /path/to/es-mgmt
uv run pytest tests/unit -v
Docker-marked tests need a local Docker daemon.
Building
cd /path/to/es-mgmt
uv build
Dependencies
elasticsearch9>=9.0.0pydantic>=2.0.0pyyaml>=6.0tiered_debug>=1.5.1
License
Apache 2.0
Author
Aaron Mildenstein
Metadata
Release files for es-mgmt 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| es_mgmt-0.1.0a1.tar.gz | 75.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| es_mgmt-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 195.6 kB
Release files / es_mgmt-0.1.0a1.tar.gz
| Download URL | es_mgmt-0.1.0a1.tar.gz |
|---|---|
| Size | 75.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a5595a8d06263970a3989c6a7143e0a99f3566fa98ae491e74553cee96ea0bc
|
|
BLAKE2b-256 checksum How to use checksums |
f1062091b912b1f7d37265521bb28ba2fdb5c61bd496ac1f98006e1d168851af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / es_mgmt-0.1.0a1-py3-none-any.whl
| Download URL | es_mgmt-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 119.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc6203fa4c501bcdf578b90576730959400cc0228996b45d0f85c09eedace3a7
|
|
BLAKE2b-256 checksum How to use checksums |
6a81e4515079943f4eeb2407fd09167559d3c63c324cb4cca98d0a75df37709a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|