{"id":28089287,"url":"https://github.com/fremen-labs/elastro","last_synced_at":"2026-03-17T06:02:03.310Z","repository":{"id":288297807,"uuid":"967006485","full_name":"Fremen-Labs/elastro","owner":"Fremen-Labs","description":"A comprehensive Python library for Elasticsearch management with both programmatic and CLI interfaces","archived":false,"fork":false,"pushed_at":"2025-04-16T18:29:13.000Z","size":123,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-25T17:16:41.616Z","etag":null,"topics":["api-client","cli-tool","data-management","database","datastream","elastic","elasticsearch","elasticsearch-client","elasticsearch-management","elasticsearch-python","python","python-library","search"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fremen-Labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"docs/roadmap.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-15T19:28:58.000Z","updated_at":"2025-04-16T19:21:18.000Z","dependencies_parsed_at":"2025-04-17T00:33:43.693Z","dependency_job_id":"949cc259-dbc1-46aa-a92c-6c529a4019ec","html_url":"https://github.com/Fremen-Labs/elastro","commit_stats":null,"previous_names":["fremen-labs/elastro"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fremen-Labs%2Felastro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fremen-Labs%2Felastro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fremen-Labs%2Felastro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fremen-Labs%2Felastro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fremen-Labs","download_url":"https://codeload.github.com/Fremen-Labs/elastro/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948336,"owners_count":21988953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","cli-tool","data-management","database","datastream","elastic","elasticsearch","elasticsearch-client","elasticsearch-management","elasticsearch-python","python","python-library","search"],"created_at":"2025-05-13T12:55:59.001Z","updated_at":"2026-03-11T00:09:12.602Z","avatar_url":"https://github.com/Fremen-Labs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elastro\n\n```text\n      .   *   .       .   *   .      .\n    .   _   .   *   .    *    .   *\n  _ __| | __ _ ___| |_ _ __ ___    .\n  / _ \\ |/ _` / __| __| '__/ _ \\  *\n |  __/ | (_| \\__ \\ |_| | | (_) |  .\n  \\___|_|\\__,_|___/\\__|_|  \\___/ .\n      .    *     .      *    .   *\n```\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n\nA comprehensive Python module for managing Elasticsearch operations within pipeline processes.\n\n## Overview\n\nElastro is a Python library designed to simplify interactions with Elasticsearch. It provides a clean, intuitive API for common Elasticsearch operations including:\n\n- Index management (create, update, delete)\n- Document operations (indexing, searching, updating)\n- Datastream management\n- Advanced query building and search functionality\n\nThe library offers both a programmatic API and a command-line interface for seamless integration with various workflows.\n\n## Table of Contents\n- [Installation](#installation)\n- [Basic Usage (Python API)](#basic-usage)\n- [CLI Usage](#cli-usage)\n- [ILM (Index Lifecycle Management)](#ilm-index-lifecycle-management)\n- [Snapshot \u0026 Restore](#snapshot--restore)\n- [Documentation \u0026 Examples](#documentation)\n\n## Installation\n\n### Global CLI Installation (Recommended)\n\nTo heavily simplify installation across all operating systems and elegantly check your Python compatibility, run our automated `install.sh` via curl:\n\n```bash\n# Safely check your python version and install the elastro CLI globally\ncurl -sSfL https://raw.githubusercontent.com/Fremen-Labs/elastro/main/install.sh | bash\n```\n\nAlternatively, if you already have pipx installed and your Python version is compatible (\u003e=3.9, \u003c3.14):\n\n```bash\n# Manual installation via pipx\npipx install elastro-client\n\n# Upgrade later\npipx upgrade elastro-client\n```\n\n### Library Installation (For Development)\n\nIf you are using Elastro as a library in your Python project:\n\n```bash\n# Using a virtual environment\npython3 -m venv venv\nsource venv/bin/activate\npip install elastro-client\n```\n\n### Troubleshooting: \"externally-managed-environment\"\n\nIf you see an `externally-managed-environment` error when running `pip install`, it means your OS (like macOS with Homebrew) prevents system-wide package installation.\n\n**Solution:** Use `pipx` (above) or a virtual environment. Do not use `--break-system-packages` unless you are certain of the consequences.\n\n## Basic Usage\n\n### Client Connection\n\n```python\nfrom elastro import ElasticsearchClient\n\n# Connect using API key\nclient = ElasticsearchClient(\n    hosts=[\"https://elasticsearch:9200\"],\n    auth={\"api_key\": \"your-api-key\"}\n)\n\n# Or using basic auth\nclient = ElasticsearchClient(\n    hosts=[\"https://elasticsearch:9200\"],\n    auth={\"username\": \"elastic\", \"password\": \"password\"}\n)\n\n# Connect to Elasticsearch\nclient.connect()\n```\n\n### Index Management\n\n```python\nfrom elastro import IndexManager\n\nindex_manager = IndexManager(client)\n\n# Create an index\nindex_manager.create(\n    name=\"products\",\n    settings={\n        \"number_of_shards\": 3,\n        \"number_of_replicas\": 1\n    },\n    mappings={\n        \"properties\": {\n            \"name\": {\"type\": \"text\"},\n            \"price\": {\"type\": \"float\"},\n            \"description\": {\"type\": \"text\"},\n            \"created\": {\"type\": \"date\"}\n        }\n    }\n)\n\n# Check if an index exists\nif index_manager.exists(\"products\"):\n    print(\"Products index exists!\")\n    \n# Delete an index\nindex_manager.delete(\"products\")\n```\n\n### Document Operations\n\n```python\nfrom elastro import DocumentManager\n\ndoc_manager = DocumentManager(client)\n\n# Index a document\ndoc_manager.index(\n    index=\"products\",\n    id=\"1\",\n    document={\n        \"name\": \"Laptop\",\n        \"price\": 999.99,\n        \"description\": \"High-performance laptop\",\n        \"created\": \"2023-05-01T12:00:00\"\n    }\n)\n\n# Search for documents\nresults = doc_manager.search(\n    index=\"products\",\n    query={\"match\": {\"name\": \"laptop\"}}\n)\n\nprint(results)\n```\n\n### CLI Usage\n\n```bash\n# Initialize configuration\nelastro config init\n\n# Launch the Elastro Local Web GUI\nelastro gui\n\n# Create an index\nelastro index create products --shards 3 --replicas 1\n\n# Interactive Template Wizard\nelastro template wizard\n\n# Interactive ILM Policy Wizard\nelastro ilm create my-policy\n\n# List ILM Policies (Table View)\nelastro ilm list\n\n# Add a document\nelastro doc index products --id 1 --file ./product.json\n\n# Search documents\nelastro doc search products --term category=laptop\n\n# View cluster health and routing allocation\nelastro cluster health\nelastro cluster allocation\n\n# Manage ingest pipelines\nelastro ingest list\nelastro ingest simulate my-pipeline --docs ./docs.json\n\n# Manage native realm security users and roles\nelastro security users list\nelastro security roles create my-role --privileges \"monitor,manage\"\n\n# View long-running cluster tasks\nelastro tasks list --detailed\n```\n\n### ILM (Index Lifecycle Management)\n\nElastro provides a powerful CLI for managing ILM policies, including an interactive wizard.\n\n```bash\n# List all policies (Table View)\nelastro ilm list\n\n# List with full JSON details (limited to first 2)\nelastro ilm list --full\n\n# Create a policy using the Interactive Wizard (Recommended)\nelastro ilm create my-policy\n# Follow the prompts to configure Hot, Warm, Cold, and Delete phases.\n\n# Create a policy from a file\nelastro ilm create my-policy --file ./policy.json\n\n# Explain lifecycle status for an index (includes step info for debugging)\nelastro ilm explain my-index\n```\n\n### Snapshot \u0026 Restore\n\nManage backup repositories and snapshots with ease.\n\n**Repositories:**\n```bash\n# List all repositories\nelastro snapshot repo list\n\n# Create a filesystem repository\nelastro snapshot repo create my_backup fs --setting location=/tmp/backups\n\n# Create an S3 repository\nelastro snapshot repo create my_s3_backup s3 --setting bucket=my-bucket --setting region=us-east-1\n```\n\n**Snapshots:**\n```bash\n# List snapshots in a repository\nelastro snapshot list my_backup\n\n# Create a snapshot (async default)\nelastro snapshot create my_backup snapshot_1\n\n# Create and wait for completion\nelastro snapshot create my_backup snapshot_2 --wait --indices \"logs-*,metrics-*\"\n\n# Restore a snapshot (Interactive Wizard)\nelastro snapshot restore\n# Launches a wizard to select repo -\u003e snapshot -\u003e indices -\u003e rename pattern\n\n# Restore specific indices from CLI\nelastro snapshot restore my_backup snapshot_1 --indices \"logs-*\"\n```\n\n## Documentation\n\nFor full details, refer to the guides in the `docs/` directory:\n- 📖 [Getting Started](https://github.com/Fremen-Labs/elastro/blob/main/docs/getting_started.md)\n- ⚙️ [API Reference](https://github.com/Fremen-Labs/elastro/blob/main/docs/api_reference.md)\n- 💻 [CLI Usage](https://github.com/Fremen-Labs/elastro/blob/main/docs/cli_usage.md)\n- 🚀 [Advanced Features](https://github.com/Fremen-Labs/elastro/blob/main/docs/advanced_features.md)\n- 🛠️ [Troubleshooting](https://github.com/Fremen-Labs/elastro/blob/main/docs/troubleshooting.md)\n\n## Examples\n\nCheck out the [examples](https://github.com/Fremen-Labs/elastro/tree/main/examples) directory for more usage examples:\n\n- [Client Connection](https://github.com/Fremen-Labs/elastro/blob/main/examples/client.py)\n- [Index Management](https://github.com/Fremen-Labs/elastro/blob/main/examples/index_management.py)\n- [Document Operations](https://github.com/Fremen-Labs/elastro/blob/main/examples/document_operations.py)\n- [Search Operations](https://github.com/Fremen-Labs/elastro/blob/main/examples/search.py)\n- [Datastream Management](https://github.com/Fremen-Labs/elastro/blob/main/examples/datastreams.py)\n\n## Contributing\n\nWe welcome contributions to Elastro! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to get started, code standards, and submission processes.\n\n\n## License\n\nMIT ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffremen-labs%2Felastro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffremen-labs%2Felastro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffremen-labs%2Felastro/lists"}