elastro-client 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. elastro_client-1.0.0/.coveragerc +18 -0
  2. elastro_client-1.0.0/LICENSE +21 -0
  3. elastro_client-1.0.0/MANIFEST.in +14 -0
  4. elastro_client-1.0.0/PKG-INFO +271 -0
  5. elastro_client-1.0.0/README.md +233 -0
  6. elastro_client-1.0.0/docs/advanced_features.md +218 -0
  7. elastro_client-1.0.0/docs/api_reference.md +229 -0
  8. elastro_client-1.0.0/docs/cli_usage.md +340 -0
  9. elastro_client-1.0.0/docs/getting_started.md +266 -0
  10. elastro_client-1.0.0/docs/roadmap.md +122 -0
  11. elastro_client-1.0.0/docs/troubleshooting.md +313 -0
  12. elastro_client-1.0.0/elastro/__init__.py +20 -0
  13. elastro_client-1.0.0/elastro/advanced/__init__.py +7 -0
  14. elastro_client-1.0.0/elastro/advanced/aggregations.py +182 -0
  15. elastro_client-1.0.0/elastro/advanced/query_builder.py +268 -0
  16. elastro_client-1.0.0/elastro/advanced/scroll.py +156 -0
  17. elastro_client-1.0.0/elastro/cli/__init__.py +9 -0
  18. elastro_client-1.0.0/elastro/cli/art.py +21 -0
  19. elastro_client-1.0.0/elastro/cli/cli.py +226 -0
  20. elastro_client-1.0.0/elastro/cli/commands/__init__.py +31 -0
  21. elastro_client-1.0.0/elastro/cli/commands/config.py +101 -0
  22. elastro_client-1.0.0/elastro/cli/commands/datastream.py +113 -0
  23. elastro_client-1.0.0/elastro/cli/commands/document.py +220 -0
  24. elastro_client-1.0.0/elastro/cli/commands/ilm.py +244 -0
  25. elastro_client-1.0.0/elastro/cli/commands/index.py +151 -0
  26. elastro_client-1.0.0/elastro/cli/commands/snapshot.py +272 -0
  27. elastro_client-1.0.0/elastro/cli/commands/template.py +155 -0
  28. elastro_client-1.0.0/elastro/cli/commands/utils.py +208 -0
  29. elastro_client-1.0.0/elastro/cli/completion.py +105 -0
  30. elastro_client-1.0.0/elastro/cli/output.py +101 -0
  31. elastro_client-1.0.0/elastro/config/__init__.py +10 -0
  32. elastro_client-1.0.0/elastro/config/defaults.py +66 -0
  33. elastro_client-1.0.0/elastro/config/loader.py +299 -0
  34. elastro_client-1.0.0/elastro/core/__init__.py +21 -0
  35. elastro_client-1.0.0/elastro/core/client.py +297 -0
  36. elastro_client-1.0.0/elastro/core/datastream.py +323 -0
  37. elastro_client-1.0.0/elastro/core/document.py +314 -0
  38. elastro_client-1.0.0/elastro/core/document_bulk.py +130 -0
  39. elastro_client-1.0.0/elastro/core/errors.py +51 -0
  40. elastro_client-1.0.0/elastro/core/ilm.py +170 -0
  41. elastro_client-1.0.0/elastro/core/index.py +256 -0
  42. elastro_client-1.0.0/elastro/core/logger.py +74 -0
  43. elastro_client-1.0.0/elastro/core/query_builder.py +163 -0
  44. elastro_client-1.0.0/elastro/core/snapshot.py +285 -0
  45. elastro_client-1.0.0/elastro/core/validation.py +240 -0
  46. elastro_client-1.0.0/elastro/py.typed +0 -0
  47. elastro_client-1.0.0/elastro/utils/__init__.py +13 -0
  48. elastro_client-1.0.0/elastro/utils/aliases.py +181 -0
  49. elastro_client-1.0.0/elastro/utils/health.py +251 -0
  50. elastro_client-1.0.0/elastro/utils/snapshots.py +257 -0
  51. elastro_client-1.0.0/elastro/utils/templates.py +93 -0
  52. elastro_client-1.0.0/elastro_client.egg-info/PKG-INFO +271 -0
  53. elastro_client-1.0.0/elastro_client.egg-info/SOURCES.txt +107 -0
  54. elastro_client-1.0.0/elastro_client.egg-info/dependency_links.txt +1 -0
  55. elastro_client-1.0.0/elastro_client.egg-info/entry_points.txt +2 -0
  56. elastro_client-1.0.0/elastro_client.egg-info/requires.txt +20 -0
  57. elastro_client-1.0.0/elastro_client.egg-info/top_level.txt +1 -0
  58. elastro_client-1.0.0/examples/client.py +122 -0
  59. elastro_client-1.0.0/examples/config_usage.py +99 -0
  60. elastro_client-1.0.0/examples/datastreams.py +348 -0
  61. elastro_client-1.0.0/examples/debug_connection.py +83 -0
  62. elastro_client-1.0.0/examples/document_operations.py +227 -0
  63. elastro_client-1.0.0/examples/index_management.py +181 -0
  64. elastro_client-1.0.0/examples/search.py +475 -0
  65. elastro_client-1.0.0/pyproject.toml +70 -0
  66. elastro_client-1.0.0/pytest.ini +10 -0
  67. elastro_client-1.0.0/requirements.txt +6 -0
  68. elastro_client-1.0.0/setup.cfg +4 -0
  69. elastro_client-1.0.0/setup.py +9 -0
  70. elastro_client-1.0.0/tests/__init__.py +1 -0
  71. elastro_client-1.0.0/tests/conftest.py +79 -0
  72. elastro_client-1.0.0/tests/fixtures/__init__.py +1 -0
  73. elastro_client-1.0.0/tests/fixtures/datastream_fixtures.py +106 -0
  74. elastro_client-1.0.0/tests/fixtures/document_fixtures.py +142 -0
  75. elastro_client-1.0.0/tests/fixtures/index_fixtures.py +66 -0
  76. elastro_client-1.0.0/tests/integration/__init__.py +1 -0
  77. elastro_client-1.0.0/tests/integration/test_aggregations_integration.py +324 -0
  78. elastro_client-1.0.0/tests/integration/test_client_integration.py +163 -0
  79. elastro_client-1.0.0/tests/integration/test_datastream_integration.py +188 -0
  80. elastro_client-1.0.0/tests/integration/test_docs_quickstart.py +106 -0
  81. elastro_client-1.0.0/tests/integration/test_document_integration.py +181 -0
  82. elastro_client-1.0.0/tests/integration/test_index_integration.py +105 -0
  83. elastro_client-1.0.0/tests/integration/test_query_builder_integration.py +219 -0
  84. elastro_client-1.0.0/tests/integration/test_scroll_integration.py +221 -0
  85. elastro_client-1.0.0/tests/integration/test_workflow_integration.py +270 -0
  86. elastro_client-1.0.0/tests/manual/test_es.py +1 -0
  87. elastro_client-1.0.0/tests/unit/__init__.py +1 -0
  88. elastro_client-1.0.0/tests/unit/advanced/__init__.py +1 -0
  89. elastro_client-1.0.0/tests/unit/advanced/test_aggregations.py +206 -0
  90. elastro_client-1.0.0/tests/unit/advanced/test_query_builder.py +277 -0
  91. elastro_client-1.0.0/tests/unit/advanced/test_scroll.py +275 -0
  92. elastro_client-1.0.0/tests/unit/config/__init__.py +1 -0
  93. elastro_client-1.0.0/tests/unit/config/test_defaults.py +136 -0
  94. elastro_client-1.0.0/tests/unit/config/test_loader.py +391 -0
  95. elastro_client-1.0.0/tests/unit/core/__init__.py +1 -0
  96. elastro_client-1.0.0/tests/unit/core/test_client.py +385 -0
  97. elastro_client-1.0.0/tests/unit/core/test_datastream.py +456 -0
  98. elastro_client-1.0.0/tests/unit/core/test_document.py +654 -0
  99. elastro_client-1.0.0/tests/unit/core/test_document_bulk.py +152 -0
  100. elastro_client-1.0.0/tests/unit/core/test_errors.py +111 -0
  101. elastro_client-1.0.0/tests/unit/core/test_index.py +540 -0
  102. elastro_client-1.0.0/tests/unit/core/test_validation.py +343 -0
  103. elastro_client-1.0.0/tests/unit/utils/__init__.py +1 -0
  104. elastro_client-1.0.0/tests/unit/utils/test_aliases.py +355 -0
  105. elastro_client-1.0.0/tests/unit/utils/test_health.py +538 -0
  106. elastro_client-1.0.0/tests/unit/utils/test_snapshots.py +488 -0
  107. elastro_client-1.0.0/tests/unit/utils/test_templates.py +272 -0
  108. elastro_client-1.0.0/tests/verify_api_actions.py +114 -0
  109. elastro_client-1.0.0/tests/verify_cli_e2e.py +229 -0
@@ -0,0 +1,18 @@
1
+ [run]
2
+ source = elastro
3
+ omit =
4
+ elastro/cli/*
5
+ tests/*
6
+ setup.py
7
+
8
+ [report]
9
+ exclude_lines =
10
+ pragma: no cover
11
+ def __repr__
12
+ raise NotImplementedError
13
+ if __name__ == .__main__.:
14
+ pass
15
+ raise ImportError
16
+
17
+ [html]
18
+ directory = htmlcov
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Fremen Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,14 @@
1
+ include LICENSE
2
+ include README.md
3
+ include requirements.txt
4
+ include pyproject.toml
5
+ include elastro/py.typed
6
+ recursive-include docs *.md
7
+ recursive-include examples *.py
8
+ recursive-include tests *.py
9
+ include pytest.ini
10
+ include .coveragerc
11
+ global-exclude *.pyc
12
+ global-exclude __pycache__
13
+ global-exclude *.so
14
+ global-exclude .DS_Store
@@ -0,0 +1,271 @@
1
+ Metadata-Version: 2.4
2
+ Name: elastro-client
3
+ Version: 1.0.0
4
+ Summary: A comprehensive Python library for Elasticsearch management with both programmatic and CLI interfaces
5
+ Author: Austin Jorgensen
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Fremen-Labs
8
+ Project-URL: Repository, https://github.com/Fremen-Labs/elastro
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Database
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: elasticsearch<9.0.0,>=8.18.0
20
+ Requires-Dist: click>=8.0.0
21
+ Requires-Dist: python-dotenv>=0.19.0
22
+ Requires-Dist: pydantic==2.11.3
23
+ Requires-Dist: pyyaml>=6.0
24
+ Requires-Dist: colorlog>=6.0.0
25
+ Requires-Dist: rich>=10.0.0
26
+ Requires-Dist: rich-click>=1.7.0
27
+ Provides-Extra: test
28
+ Requires-Dist: pytest>=7.0.0; extra == "test"
29
+ Requires-Dist: pytest-cov>=3.0.0; extra == "test"
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
32
+ Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
33
+ Requires-Dist: black>=22.0.0; extra == "dev"
34
+ Requires-Dist: isort>=5.0.0; extra == "dev"
35
+ Requires-Dist: mypy>=0.9.0; extra == "dev"
36
+ Requires-Dist: flake8>=4.0.0; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ # Elastro
40
+
41
+ ```text
42
+ . * . . * . .
43
+ . _ . * . * . *
44
+ _ __| | __ _ ___| |_ _ __ ___ .
45
+ / _ \ |/ _` / __| __| '__/ _ \ *
46
+ | __/ | (_| \__ \ |_| | | (_) | .
47
+ \___|_|\__,_|___/\__|_| \___/ .
48
+ . * . * . *
49
+ ```
50
+
51
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
52
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
53
+ [![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
54
+
55
+
56
+ A comprehensive Python module for managing Elasticsearch operations within pipeline processes.
57
+
58
+ ## Overview
59
+
60
+ Elastro is a Python library designed to simplify interactions with Elasticsearch. It provides a clean, intuitive API for common Elasticsearch operations including:
61
+
62
+ - Index management (create, update, delete)
63
+ - Document operations (indexing, searching, updating)
64
+ - Datastream management
65
+ - Advanced query building and search functionality
66
+
67
+ The library offers both a programmatic API and a command-line interface for seamless integration with various workflows.
68
+
69
+ ## Installation
70
+
71
+ ```bash
72
+ pip install elastro
73
+ ```
74
+
75
+ Or from source:
76
+
77
+ ```bash
78
+ git clone https://github.com/Fremen-Labs/elastro.git
79
+ cd elastro
80
+ pip install -e .
81
+ ```
82
+
83
+ ## Basic Usage
84
+
85
+ ### Client Connection
86
+
87
+ ```python
88
+ from elastro import ElasticsearchClient
89
+
90
+ # Connect using API key
91
+ client = ElasticsearchClient(
92
+ hosts=["https://elasticsearch:9200"],
93
+ auth={"api_key": "your-api-key"}
94
+ )
95
+
96
+ # Or using basic auth
97
+ client = ElasticsearchClient(
98
+ hosts=["https://elasticsearch:9200"],
99
+ auth={"username": "elastic", "password": "password"}
100
+ )
101
+
102
+ # Connect to Elasticsearch
103
+ client.connect()
104
+ ```
105
+
106
+ ### Index Management
107
+
108
+ ```python
109
+ from elastro import IndexManager
110
+
111
+ index_manager = IndexManager(client)
112
+
113
+ # Create an index
114
+ index_manager.create(
115
+ name="products",
116
+ settings={
117
+ "number_of_shards": 3,
118
+ "number_of_replicas": 1
119
+ },
120
+ mappings={
121
+ "properties": {
122
+ "name": {"type": "text"},
123
+ "price": {"type": "float"},
124
+ "description": {"type": "text"},
125
+ "created": {"type": "date"}
126
+ }
127
+ }
128
+ )
129
+
130
+ # Check if an index exists
131
+ if index_manager.exists("products"):
132
+ print("Products index exists!")
133
+
134
+ # Delete an index
135
+ index_manager.delete("products")
136
+ ```
137
+
138
+ ### Document Operations
139
+
140
+ ```python
141
+ from elastro import DocumentManager
142
+
143
+ doc_manager = DocumentManager(client)
144
+
145
+ # Index a document
146
+ doc_manager.index(
147
+ index="products",
148
+ id="1",
149
+ document={
150
+ "name": "Laptop",
151
+ "price": 999.99,
152
+ "description": "High-performance laptop",
153
+ "created": "2023-05-01T12:00:00"
154
+ }
155
+ )
156
+
157
+ # Search for documents
158
+ results = doc_manager.search(
159
+ index="products",
160
+ query={"match": {"name": "laptop"}}
161
+ )
162
+
163
+ print(results)
164
+ ```
165
+
166
+ ### CLI Usage
167
+
168
+ ```bash
169
+ # Initialize configuration
170
+ elastro config init
171
+
172
+ # Create an index
173
+ elastro index create products --shards 3 --replicas 1
174
+
175
+ # Interactive Template Wizard
176
+ elastro template wizard
177
+
178
+ # Interactive ILM Policy Wizard
179
+ elastro ilm create my-policy
180
+
181
+ # List ILM Policies (Table View)
182
+ elastro ilm list
183
+
184
+ # Add a document
185
+ elastro doc index products --id 1 --file ./product.json
186
+
187
+ # Search documents
188
+ elastro doc search products --term category=laptop
189
+ ```
190
+
191
+ ### ILM (Index Lifecycle Management)
192
+
193
+ Elastro provides a powerful CLI for managing ILM policies, including an interactive wizard.
194
+
195
+ ```bash
196
+ # List all policies (Table View)
197
+ elastro ilm list
198
+
199
+ # List with full JSON details (limited to first 2)
200
+ elastro ilm list --full
201
+
202
+ # Create a policy using the Interactive Wizard (Recommended)
203
+ elastro ilm create my-policy
204
+ # Follow the prompts to configure Hot, Warm, Cold, and Delete phases.
205
+
206
+ # Create a policy from a file
207
+ elastro ilm create my-policy --file ./policy.json
208
+
209
+ # Explain lifecycle status for an index (includes step info for debugging)
210
+ elastro ilm explain my-index
211
+ ```
212
+
213
+ ### Snapshot & Restore
214
+
215
+ Manage backup repositories and snapshots with ease.
216
+
217
+ **Repositories:**
218
+ ```bash
219
+ # List all repositories
220
+ elastro snapshot repo list
221
+
222
+ # Create a filesystem repository
223
+ elastro snapshot repo create my_backup fs --setting location=/tmp/backups
224
+
225
+ # Create an S3 repository
226
+ elastro snapshot repo create my_s3_backup s3 --setting bucket=my-bucket --setting region=us-east-1
227
+ ```
228
+
229
+ **Snapshots:**
230
+ ```bash
231
+ # List snapshots in a repository
232
+ elastro snapshot list my_backup
233
+
234
+ # Create a snapshot (async default)
235
+ elastro snapshot create my_backup snapshot_1
236
+
237
+ # Create and wait for completion
238
+ elastro snapshot create my_backup snapshot_2 --wait --indices "logs-*,metrics-*"
239
+
240
+ # Restore a snapshot (Interactive Wizard)
241
+ elastro snapshot restore
242
+ # Launches a wizard to select repo -> snapshot -> indices -> rename pattern
243
+
244
+ # Restore specific indices from CLI
245
+ elastro snapshot restore my_backup snapshot_1 --indices "logs-*"
246
+ ```
247
+
248
+ - [Getting Started](https://github.com/Fremen-Labs/elastro/blob/main/docs/getting_started.md)
249
+ - [API Reference](https://github.com/Fremen-Labs/elastro/blob/main/docs/api_reference.md)
250
+ - [CLI Usage](https://github.com/Fremen-Labs/elastro/blob/main/docs/cli_usage.md)
251
+ - [Advanced Features](https://github.com/Fremen-Labs/elastro/blob/main/docs/advanced_features.md)
252
+ - [Troubleshooting](https://github.com/Fremen-Labs/elastro/blob/main/docs/troubleshooting.md)
253
+
254
+ ## Examples
255
+
256
+ Check out the [examples](https://github.com/Fremen-Labs/elastro/tree/main/examples) directory for more usage examples:
257
+
258
+ - [Client Connection](https://github.com/Fremen-Labs/elastro/blob/main/examples/client.py)
259
+ - [Index Management](https://github.com/Fremen-Labs/elastro/blob/main/examples/index_management.py)
260
+ - [Document Operations](https://github.com/Fremen-Labs/elastro/blob/main/examples/document_operations.py)
261
+ - [Search Operations](https://github.com/Fremen-Labs/elastro/blob/main/examples/search.py)
262
+ - [Datastream Management](https://github.com/Fremen-Labs/elastro/blob/main/examples/datastreams.py)
263
+
264
+ ## Contributing
265
+
266
+ We welcome contributions to Elastro! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to get started, code standards, and submission processes.
267
+
268
+
269
+ ## License
270
+
271
+ MIT
@@ -0,0 +1,233 @@
1
+ # Elastro
2
+
3
+ ```text
4
+ . * . . * . .
5
+ . _ . * . * . *
6
+ _ __| | __ _ ___| |_ _ __ ___ .
7
+ / _ \ |/ _` / __| __| '__/ _ \ *
8
+ | __/ | (_| \__ \ |_| | | (_) | .
9
+ \___|_|\__,_|___/\__|_| \___/ .
10
+ . * . * . *
11
+ ```
12
+
13
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
14
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
15
+ [![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
16
+
17
+
18
+ A comprehensive Python module for managing Elasticsearch operations within pipeline processes.
19
+
20
+ ## Overview
21
+
22
+ Elastro is a Python library designed to simplify interactions with Elasticsearch. It provides a clean, intuitive API for common Elasticsearch operations including:
23
+
24
+ - Index management (create, update, delete)
25
+ - Document operations (indexing, searching, updating)
26
+ - Datastream management
27
+ - Advanced query building and search functionality
28
+
29
+ The library offers both a programmatic API and a command-line interface for seamless integration with various workflows.
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ pip install elastro
35
+ ```
36
+
37
+ Or from source:
38
+
39
+ ```bash
40
+ git clone https://github.com/Fremen-Labs/elastro.git
41
+ cd elastro
42
+ pip install -e .
43
+ ```
44
+
45
+ ## Basic Usage
46
+
47
+ ### Client Connection
48
+
49
+ ```python
50
+ from elastro import ElasticsearchClient
51
+
52
+ # Connect using API key
53
+ client = ElasticsearchClient(
54
+ hosts=["https://elasticsearch:9200"],
55
+ auth={"api_key": "your-api-key"}
56
+ )
57
+
58
+ # Or using basic auth
59
+ client = ElasticsearchClient(
60
+ hosts=["https://elasticsearch:9200"],
61
+ auth={"username": "elastic", "password": "password"}
62
+ )
63
+
64
+ # Connect to Elasticsearch
65
+ client.connect()
66
+ ```
67
+
68
+ ### Index Management
69
+
70
+ ```python
71
+ from elastro import IndexManager
72
+
73
+ index_manager = IndexManager(client)
74
+
75
+ # Create an index
76
+ index_manager.create(
77
+ name="products",
78
+ settings={
79
+ "number_of_shards": 3,
80
+ "number_of_replicas": 1
81
+ },
82
+ mappings={
83
+ "properties": {
84
+ "name": {"type": "text"},
85
+ "price": {"type": "float"},
86
+ "description": {"type": "text"},
87
+ "created": {"type": "date"}
88
+ }
89
+ }
90
+ )
91
+
92
+ # Check if an index exists
93
+ if index_manager.exists("products"):
94
+ print("Products index exists!")
95
+
96
+ # Delete an index
97
+ index_manager.delete("products")
98
+ ```
99
+
100
+ ### Document Operations
101
+
102
+ ```python
103
+ from elastro import DocumentManager
104
+
105
+ doc_manager = DocumentManager(client)
106
+
107
+ # Index a document
108
+ doc_manager.index(
109
+ index="products",
110
+ id="1",
111
+ document={
112
+ "name": "Laptop",
113
+ "price": 999.99,
114
+ "description": "High-performance laptop",
115
+ "created": "2023-05-01T12:00:00"
116
+ }
117
+ )
118
+
119
+ # Search for documents
120
+ results = doc_manager.search(
121
+ index="products",
122
+ query={"match": {"name": "laptop"}}
123
+ )
124
+
125
+ print(results)
126
+ ```
127
+
128
+ ### CLI Usage
129
+
130
+ ```bash
131
+ # Initialize configuration
132
+ elastro config init
133
+
134
+ # Create an index
135
+ elastro index create products --shards 3 --replicas 1
136
+
137
+ # Interactive Template Wizard
138
+ elastro template wizard
139
+
140
+ # Interactive ILM Policy Wizard
141
+ elastro ilm create my-policy
142
+
143
+ # List ILM Policies (Table View)
144
+ elastro ilm list
145
+
146
+ # Add a document
147
+ elastro doc index products --id 1 --file ./product.json
148
+
149
+ # Search documents
150
+ elastro doc search products --term category=laptop
151
+ ```
152
+
153
+ ### ILM (Index Lifecycle Management)
154
+
155
+ Elastro provides a powerful CLI for managing ILM policies, including an interactive wizard.
156
+
157
+ ```bash
158
+ # List all policies (Table View)
159
+ elastro ilm list
160
+
161
+ # List with full JSON details (limited to first 2)
162
+ elastro ilm list --full
163
+
164
+ # Create a policy using the Interactive Wizard (Recommended)
165
+ elastro ilm create my-policy
166
+ # Follow the prompts to configure Hot, Warm, Cold, and Delete phases.
167
+
168
+ # Create a policy from a file
169
+ elastro ilm create my-policy --file ./policy.json
170
+
171
+ # Explain lifecycle status for an index (includes step info for debugging)
172
+ elastro ilm explain my-index
173
+ ```
174
+
175
+ ### Snapshot & Restore
176
+
177
+ Manage backup repositories and snapshots with ease.
178
+
179
+ **Repositories:**
180
+ ```bash
181
+ # List all repositories
182
+ elastro snapshot repo list
183
+
184
+ # Create a filesystem repository
185
+ elastro snapshot repo create my_backup fs --setting location=/tmp/backups
186
+
187
+ # Create an S3 repository
188
+ elastro snapshot repo create my_s3_backup s3 --setting bucket=my-bucket --setting region=us-east-1
189
+ ```
190
+
191
+ **Snapshots:**
192
+ ```bash
193
+ # List snapshots in a repository
194
+ elastro snapshot list my_backup
195
+
196
+ # Create a snapshot (async default)
197
+ elastro snapshot create my_backup snapshot_1
198
+
199
+ # Create and wait for completion
200
+ elastro snapshot create my_backup snapshot_2 --wait --indices "logs-*,metrics-*"
201
+
202
+ # Restore a snapshot (Interactive Wizard)
203
+ elastro snapshot restore
204
+ # Launches a wizard to select repo -> snapshot -> indices -> rename pattern
205
+
206
+ # Restore specific indices from CLI
207
+ elastro snapshot restore my_backup snapshot_1 --indices "logs-*"
208
+ ```
209
+
210
+ - [Getting Started](https://github.com/Fremen-Labs/elastro/blob/main/docs/getting_started.md)
211
+ - [API Reference](https://github.com/Fremen-Labs/elastro/blob/main/docs/api_reference.md)
212
+ - [CLI Usage](https://github.com/Fremen-Labs/elastro/blob/main/docs/cli_usage.md)
213
+ - [Advanced Features](https://github.com/Fremen-Labs/elastro/blob/main/docs/advanced_features.md)
214
+ - [Troubleshooting](https://github.com/Fremen-Labs/elastro/blob/main/docs/troubleshooting.md)
215
+
216
+ ## Examples
217
+
218
+ Check out the [examples](https://github.com/Fremen-Labs/elastro/tree/main/examples) directory for more usage examples:
219
+
220
+ - [Client Connection](https://github.com/Fremen-Labs/elastro/blob/main/examples/client.py)
221
+ - [Index Management](https://github.com/Fremen-Labs/elastro/blob/main/examples/index_management.py)
222
+ - [Document Operations](https://github.com/Fremen-Labs/elastro/blob/main/examples/document_operations.py)
223
+ - [Search Operations](https://github.com/Fremen-Labs/elastro/blob/main/examples/search.py)
224
+ - [Datastream Management](https://github.com/Fremen-Labs/elastro/blob/main/examples/datastreams.py)
225
+
226
+ ## Contributing
227
+
228
+ We welcome contributions to Elastro! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to get started, code standards, and submission processes.
229
+
230
+
231
+ ## License
232
+
233
+ MIT