elastro-client 1.3.52__tar.gz → 1.3.53__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.
- {elastro_client-1.3.52/elastro_client.egg-info → elastro_client-1.3.53}/PKG-INFO +1 -1
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/__init__.py +1 -1
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/cli.py +0 -7
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/client.py +1 -2
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/middleware.py +5 -3
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/rag/ast_parser.py +0 -1
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/rag/ingestor.py +2 -2
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/validation.py +9 -6
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/server.py +8 -6
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/utils/health.py +23 -18
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/utils/snapshots.py +20 -15
- {elastro_client-1.3.52 → elastro_client-1.3.53/elastro_client.egg-info}/PKG-INFO +1 -1
- {elastro_client-1.3.52 → elastro_client-1.3.53}/pyproject.toml +1 -1
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/utils/test_health.py +1 -1
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/utils/test_snapshots.py +4 -4
- {elastro_client-1.3.52 → elastro_client-1.3.53}/.coveragerc +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/LICENSE +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/MANIFEST.in +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/README.md +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/docs/advanced_features.md +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/docs/api_reference.md +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/docs/cli_usage.md +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/docs/commands_reference.md +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/docs/getting_started.md +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/docs/roadmap.md +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/docs/troubleshooting.md +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/advanced/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/advanced/aggregations.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/advanced/query_builder.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/advanced/scroll.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/art.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/cluster.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/config.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/daemon.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/datastream.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/document.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/gui.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/ilm.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/index.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/index_recipes.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/ingest.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/memory.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/ml.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/painless_commands.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/rag.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/script.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/security.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/snapshot.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/tasks.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/telemetry.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/template.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/tools.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/commands/utils.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/completion.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/cli/output.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/config/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/config/defaults.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/config/loader.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/base.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/daemon.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/datastream.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/document.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/document_bulk.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/errors.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/ilm.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/index.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/logger.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/query_builder.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/core/snapshot.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/gui/assets/index-CeUjjtn-.css +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/gui/assets/index-DNdGuJvV.js +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/gui/elastro.svg +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/gui/favicon.ico +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/gui/index.html +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/gui/vite.svg +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/py.typed +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/utils/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/utils/aliases.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro/utils/templates.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro_client.egg-info/SOURCES.txt +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro_client.egg-info/dependency_links.txt +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro_client.egg-info/entry_points.txt +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro_client.egg-info/requires.txt +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/elastro_client.egg-info/top_level.txt +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/examples/client.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/examples/config_usage.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/examples/datastreams.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/examples/debug_connection.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/examples/document_operations.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/examples/index_management.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/examples/search.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/pytest.ini +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/requirements.txt +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/setup.cfg +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/setup.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/conftest.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/fixtures/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/fixtures/datastream_fixtures.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/fixtures/document_fixtures.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/fixtures/index_fixtures.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_aggregations_integration.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_client_integration.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_datastream_integration.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_docs_quickstart.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_document_integration.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_index_integration.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_query_builder_integration.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_scroll_integration.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_workflow_integration.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/manual/test_es.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/advanced/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/advanced/test_aggregations.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/advanced/test_query_builder.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/advanced/test_scroll.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/config/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/config/test_defaults.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/config/test_loader.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/core/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/core/test_client.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/core/test_datastream.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/core/test_document.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/core/test_document_bulk.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/core/test_errors.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/core/test_index.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/core/test_validation.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/utils/__init__.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/utils/test_aliases.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/unit/utils/test_templates.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/verify_api_actions.py +0 -0
- {elastro_client-1.3.52 → elastro_client-1.3.53}/tests/verify_cli_e2e.py +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# mypy: ignore-errors
|
|
2
1
|
"""
|
|
3
2
|
Elasticsearch client module.
|
|
4
3
|
|
|
@@ -106,7 +105,7 @@ class ElasticsearchClient:
|
|
|
106
105
|
self.auth = {"api_key": api_key}
|
|
107
106
|
|
|
108
107
|
self.client_kwargs = kwargs
|
|
109
|
-
self._client = None
|
|
108
|
+
self._client: Optional[Elasticsearch] = None
|
|
110
109
|
self._connected = False
|
|
111
110
|
|
|
112
111
|
logger.debug(f"Initialized ElasticsearchClient with hosts: {self.hosts}")
|
|
@@ -24,7 +24,9 @@ class ASTNodeIDMiddleware:
|
|
|
24
24
|
def process(self, query: Dict[str, Any]) -> Dict[str, Any]:
|
|
25
25
|
"""Inspects query. Adds structural markers or raises if malformed."""
|
|
26
26
|
if self.enforce:
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
|
|
27
|
+
# TODO: Implement AST Node-ID bridging validation.
|
|
28
|
+
# Should ensure semantic queries conform to known graph topologies.
|
|
29
|
+
raise NotImplementedError(
|
|
30
|
+
"AST Node-ID bridging validation is not yet implemented"
|
|
31
|
+
)
|
|
30
32
|
return query
|
|
@@ -7,12 +7,12 @@ Updated with Semantic Chunking and BM25 Support.
|
|
|
7
7
|
|
|
8
8
|
import os
|
|
9
9
|
import json
|
|
10
|
-
import logging
|
|
11
10
|
from typing import List, Dict, Any, Generator, Optional
|
|
12
11
|
from elastro.core.client import ElasticsearchClient
|
|
13
12
|
from elastro.core.rag.ast_parser import ASTParser
|
|
13
|
+
from elastro.core.logger import get_logger
|
|
14
14
|
|
|
15
|
-
logger =
|
|
15
|
+
logger = get_logger(__name__)
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class GraphRAGManager:
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
# mypy: ignore-errors
|
|
2
1
|
"""
|
|
3
2
|
Validation module.
|
|
4
3
|
|
|
5
4
|
This module provides functionality for validating Elasticsearch operations.
|
|
6
5
|
"""
|
|
7
6
|
|
|
8
|
-
from typing import Dict, Any, Optional, List, Union
|
|
7
|
+
from typing import Dict, Any, Optional, List, Type, Union
|
|
9
8
|
from pydantic import (
|
|
10
9
|
BaseModel,
|
|
11
10
|
ValidationError as PydanticValidationError,
|
|
@@ -127,7 +126,7 @@ class Validator:
|
|
|
127
126
|
documents, queries, and other Elasticsearch operations.
|
|
128
127
|
"""
|
|
129
128
|
|
|
130
|
-
def validate_index_settings(self, settings: Dict[str, Any]) ->
|
|
129
|
+
def validate_index_settings(self, settings: Dict[str, Any]) -> Dict[str, Any]:
|
|
131
130
|
"""
|
|
132
131
|
Validate index settings.
|
|
133
132
|
|
|
@@ -152,7 +151,7 @@ class Validator:
|
|
|
152
151
|
f"Invalid index settings: {', '.join(error_messages)}"
|
|
153
152
|
)
|
|
154
153
|
|
|
155
|
-
def validate_index_mappings(self, mappings: Dict[str, Any]) ->
|
|
154
|
+
def validate_index_mappings(self, mappings: Dict[str, Any]) -> Dict[str, Any]:
|
|
156
155
|
"""
|
|
157
156
|
Validate index mappings.
|
|
158
157
|
|
|
@@ -243,18 +242,22 @@ class Validator:
|
|
|
243
242
|
raise
|
|
244
243
|
raise ValidationError(f"Document validation failed: {str(e)}")
|
|
245
244
|
|
|
246
|
-
def validate_query(self, query: Dict[str, Any]) ->
|
|
245
|
+
def validate_query(self, query: Dict[str, Any]) -> Dict[str, Any]:
|
|
247
246
|
"""
|
|
248
247
|
Validate Elasticsearch query.
|
|
249
248
|
|
|
250
249
|
Args:
|
|
251
250
|
query: Elasticsearch query
|
|
252
251
|
|
|
252
|
+
Returns:
|
|
253
|
+
Dict containing the validated query fields
|
|
254
|
+
|
|
253
255
|
Raises:
|
|
254
256
|
ValidationError: If query validation fails
|
|
255
257
|
"""
|
|
256
258
|
try:
|
|
257
259
|
# Determine query type
|
|
260
|
+
model_cls: Type[QueryModel]
|
|
258
261
|
if "match" in query:
|
|
259
262
|
model_cls = MatchQuery
|
|
260
263
|
elif "term" in query:
|
|
@@ -276,7 +279,7 @@ class Validator:
|
|
|
276
279
|
]
|
|
277
280
|
raise ValidationError(f"Invalid query: {', '.join(error_messages)}")
|
|
278
281
|
|
|
279
|
-
def validate_datastream_settings(self, settings: Dict[str, Any]) ->
|
|
282
|
+
def validate_datastream_settings(self, settings: Dict[str, Any]) -> Dict[str, Any]:
|
|
280
283
|
"""
|
|
281
284
|
Validate datastream settings.
|
|
282
285
|
|
|
@@ -3,7 +3,6 @@ import sys
|
|
|
3
3
|
import io
|
|
4
4
|
import secrets
|
|
5
5
|
import json
|
|
6
|
-
import logging
|
|
7
6
|
import multiprocessing
|
|
8
7
|
import shlex
|
|
9
8
|
import subprocess
|
|
@@ -15,6 +14,9 @@ from fastapi.staticfiles import StaticFiles
|
|
|
15
14
|
from fastapi.responses import HTMLResponse
|
|
16
15
|
from fastapi.middleware.cors import CORSMiddleware
|
|
17
16
|
from elastro.core.client import ElasticsearchClient
|
|
17
|
+
from elastro.core.logger import get_logger
|
|
18
|
+
|
|
19
|
+
logger = get_logger(__name__)
|
|
18
20
|
|
|
19
21
|
# Optional Pydantic based schema since Elastro uses Pydantic
|
|
20
22
|
from pydantic import BaseModel
|
|
@@ -259,7 +261,7 @@ class ElastroGUI:
|
|
|
259
261
|
)
|
|
260
262
|
|
|
261
263
|
except Exception as e:
|
|
262
|
-
|
|
264
|
+
logger.error(f"Failed to connect to {c['name']}: {str(e)}")
|
|
263
265
|
results.append(
|
|
264
266
|
{
|
|
265
267
|
"name": c["name"],
|
|
@@ -331,7 +333,7 @@ class ElastroGUI:
|
|
|
331
333
|
ilm_policies = es.ilm.get_lifecycle()
|
|
332
334
|
ilm_count = len(ilm_policies)
|
|
333
335
|
except Exception as e:
|
|
334
|
-
|
|
336
|
+
logger.warning(f"Could not fetch ILM for {cluster_name}: {e}")
|
|
335
337
|
ilm_count = 0
|
|
336
338
|
|
|
337
339
|
# Snapshots / Backups
|
|
@@ -343,7 +345,7 @@ class ElastroGUI:
|
|
|
343
345
|
{"name": r_name, "type": r_data.get("type", "unknown")}
|
|
344
346
|
)
|
|
345
347
|
except Exception as e:
|
|
346
|
-
|
|
348
|
+
logger.warning(f"Could not fetch Repos for {cluster_name}: {e}")
|
|
347
349
|
|
|
348
350
|
# Indices detailed summary
|
|
349
351
|
idx_res = es.cat.indices(format="json")
|
|
@@ -374,7 +376,7 @@ class ElastroGUI:
|
|
|
374
376
|
}
|
|
375
377
|
|
|
376
378
|
except Exception as e:
|
|
377
|
-
|
|
379
|
+
logger.error(f"Failed to fetch details for {cluster_name}: {str(e)}")
|
|
378
380
|
raise HTTPException(
|
|
379
381
|
status_code=500,
|
|
380
382
|
detail=f"Failed communicating with Elasticsearch: {str(e)}",
|
|
@@ -574,7 +576,7 @@ class ElastroGUI:
|
|
|
574
576
|
}
|
|
575
577
|
)
|
|
576
578
|
except Exception as e:
|
|
577
|
-
|
|
579
|
+
logger.error(f"Failed to explain {name}: {e}")
|
|
578
580
|
results.append(
|
|
579
581
|
{
|
|
580
582
|
"index": name,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# mypy: ignore-errors
|
|
2
1
|
"""Health check and diagnostics utilities for Elasticsearch."""
|
|
3
2
|
|
|
4
3
|
from typing import Dict, List, Any, Optional, Union
|
|
@@ -50,9 +49,9 @@ class HealthManager:
|
|
|
50
49
|
params["wait_for_status"] = wait_for_status
|
|
51
50
|
|
|
52
51
|
if index:
|
|
53
|
-
return self._es.cluster.health(index=index, **params)
|
|
52
|
+
return dict(self._es.cluster.health(index=index, **params))
|
|
54
53
|
else:
|
|
55
|
-
return self._es.cluster.health(**params)
|
|
54
|
+
return dict(self._es.cluster.health(**params))
|
|
56
55
|
except Exception as e:
|
|
57
56
|
raise OperationError(f"Failed to get cluster health: {str(e)}")
|
|
58
57
|
|
|
@@ -73,13 +72,15 @@ class HealthManager:
|
|
|
73
72
|
"""
|
|
74
73
|
try:
|
|
75
74
|
if node_id and metrics:
|
|
76
|
-
return
|
|
75
|
+
return dict(
|
|
76
|
+
self._es.nodes.stats(node_id=node_id, metric=",".join(metrics))
|
|
77
|
+
)
|
|
77
78
|
elif node_id:
|
|
78
|
-
return self._es.nodes.stats(node_id=node_id)
|
|
79
|
+
return dict(self._es.nodes.stats(node_id=node_id))
|
|
79
80
|
elif metrics:
|
|
80
|
-
return self._es.nodes.stats(metric=",".join(metrics))
|
|
81
|
+
return dict(self._es.nodes.stats(metric=",".join(metrics)))
|
|
81
82
|
else:
|
|
82
|
-
return self._es.nodes.stats()
|
|
83
|
+
return dict(self._es.nodes.stats())
|
|
83
84
|
except Exception as e:
|
|
84
85
|
raise OperationError(f"Failed to get node stats: {str(e)}")
|
|
85
86
|
|
|
@@ -100,13 +101,15 @@ class HealthManager:
|
|
|
100
101
|
"""
|
|
101
102
|
try:
|
|
102
103
|
if node_id and metrics:
|
|
103
|
-
return
|
|
104
|
+
return dict(
|
|
105
|
+
self._es.nodes.info(node_id=node_id, metric=",".join(metrics))
|
|
106
|
+
)
|
|
104
107
|
elif node_id:
|
|
105
|
-
return self._es.nodes.info(node_id=node_id)
|
|
108
|
+
return dict(self._es.nodes.info(node_id=node_id))
|
|
106
109
|
elif metrics:
|
|
107
|
-
return self._es.nodes.info(metric=",".join(metrics))
|
|
110
|
+
return dict(self._es.nodes.info(metric=",".join(metrics)))
|
|
108
111
|
else:
|
|
109
|
-
return self._es.nodes.info()
|
|
112
|
+
return dict(self._es.nodes.info())
|
|
110
113
|
except Exception as e:
|
|
111
114
|
raise OperationError(f"Failed to get node info: {str(e)}")
|
|
112
115
|
|
|
@@ -120,7 +123,7 @@ class HealthManager:
|
|
|
120
123
|
OperationError: If cluster stats retrieval fails.
|
|
121
124
|
"""
|
|
122
125
|
try:
|
|
123
|
-
return self._es.cluster.stats()
|
|
126
|
+
return dict(self._es.cluster.stats())
|
|
124
127
|
except Exception as e:
|
|
125
128
|
raise OperationError(f"Failed to get cluster stats: {str(e)}")
|
|
126
129
|
|
|
@@ -167,9 +170,9 @@ class HealthManager:
|
|
|
167
170
|
body["primary"] = primary
|
|
168
171
|
|
|
169
172
|
if body:
|
|
170
|
-
return self._es.cluster.allocation_explain(body=body)
|
|
173
|
+
return dict(self._es.cluster.allocation_explain(body=body))
|
|
171
174
|
else:
|
|
172
|
-
return self._es.cluster.allocation_explain()
|
|
175
|
+
return dict(self._es.cluster.allocation_explain())
|
|
173
176
|
except Exception as e:
|
|
174
177
|
raise OperationError(f"Failed to explain allocation: {str(e)}")
|
|
175
178
|
|
|
@@ -186,7 +189,9 @@ class HealthManager:
|
|
|
186
189
|
OperationError: If settings retrieval fails.
|
|
187
190
|
"""
|
|
188
191
|
try:
|
|
189
|
-
return
|
|
192
|
+
return dict(
|
|
193
|
+
self._es.cluster.get_settings(include_defaults=include_defaults)
|
|
194
|
+
)
|
|
190
195
|
except Exception as e:
|
|
191
196
|
raise OperationError(f"Failed to get cluster settings: {str(e)}")
|
|
192
197
|
|
|
@@ -203,7 +208,7 @@ class HealthManager:
|
|
|
203
208
|
OperationError: If repository verification fails.
|
|
204
209
|
"""
|
|
205
210
|
try:
|
|
206
|
-
response = self._es.snapshot.verify_repository(
|
|
211
|
+
response = self._es.snapshot.verify_repository(name=repository)
|
|
207
212
|
return "nodes" in response
|
|
208
213
|
except Exception as e:
|
|
209
214
|
raise OperationError(f"Failed to verify repository {repository}: {str(e)}")
|
|
@@ -222,9 +227,9 @@ class HealthManager:
|
|
|
222
227
|
"""
|
|
223
228
|
try:
|
|
224
229
|
if index:
|
|
225
|
-
return self._es.indices.stats(index=index)
|
|
230
|
+
return dict(self._es.indices.stats(index=index))
|
|
226
231
|
else:
|
|
227
|
-
return self._es.indices.stats()
|
|
232
|
+
return dict(self._es.indices.stats())
|
|
228
233
|
except Exception as e:
|
|
229
234
|
raise OperationError(f"Failed to get index stats: {str(e)}")
|
|
230
235
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# mypy: ignore-errors
|
|
2
1
|
"""Snapshot and restore utilities for Elasticsearch."""
|
|
3
2
|
|
|
4
3
|
from typing import Dict, List, Any, Optional, Union
|
|
@@ -71,7 +70,7 @@ class SnapshotManager:
|
|
|
71
70
|
config = repo_config
|
|
72
71
|
|
|
73
72
|
response = self._es.snapshot.create_repository(
|
|
74
|
-
|
|
73
|
+
name=config.name,
|
|
75
74
|
body={"type": config.type, "settings": config.settings},
|
|
76
75
|
)
|
|
77
76
|
return bool(response.get("acknowledged", False))
|
|
@@ -98,7 +97,7 @@ class SnapshotManager:
|
|
|
98
97
|
OperationError: If repository deletion fails.
|
|
99
98
|
"""
|
|
100
99
|
try:
|
|
101
|
-
response = self._es.snapshot.delete_repository(
|
|
100
|
+
response = self._es.snapshot.delete_repository(name=name)
|
|
102
101
|
return response.get("acknowledged", False)
|
|
103
102
|
except Exception as e:
|
|
104
103
|
raise OperationError(f"Failed to delete repository {name}: {str(e)}")
|
|
@@ -118,9 +117,9 @@ class SnapshotManager:
|
|
|
118
117
|
"""
|
|
119
118
|
try:
|
|
120
119
|
if name:
|
|
121
|
-
return self._es.snapshot.get_repository(
|
|
120
|
+
return dict(self._es.snapshot.get_repository(name=name))
|
|
122
121
|
else:
|
|
123
|
-
return self._es.snapshot.get_repository()
|
|
122
|
+
return dict(self._es.snapshot.get_repository())
|
|
124
123
|
except Exception as e:
|
|
125
124
|
raise OperationError(f"Failed to get repository information: {str(e)}")
|
|
126
125
|
|
|
@@ -207,7 +206,9 @@ class SnapshotManager:
|
|
|
207
206
|
OperationError: If snapshot retrieval fails.
|
|
208
207
|
"""
|
|
209
208
|
try:
|
|
210
|
-
return
|
|
209
|
+
return dict(
|
|
210
|
+
self._es.snapshot.get(repository=repo_name, snapshot=snapshot_name)
|
|
211
|
+
)
|
|
211
212
|
except Exception as e:
|
|
212
213
|
raise OperationError(f"Failed to get snapshot information: {str(e)}")
|
|
213
214
|
|
|
@@ -244,11 +245,13 @@ class SnapshotManager:
|
|
|
244
245
|
body["rename_pattern"] = rename_pattern
|
|
245
246
|
body["rename_replacement"] = rename_replacement
|
|
246
247
|
|
|
247
|
-
return
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
return dict(
|
|
249
|
+
self._es.snapshot.restore(
|
|
250
|
+
repository=repo_name,
|
|
251
|
+
snapshot=snapshot_name,
|
|
252
|
+
body=body,
|
|
253
|
+
wait_for_completion=wait_for_completion,
|
|
254
|
+
)
|
|
252
255
|
)
|
|
253
256
|
except Exception as e:
|
|
254
257
|
raise OperationError(
|
|
@@ -272,12 +275,14 @@ class SnapshotManager:
|
|
|
272
275
|
"""
|
|
273
276
|
try:
|
|
274
277
|
if repo_name and snapshot_name:
|
|
275
|
-
return
|
|
276
|
-
|
|
278
|
+
return dict(
|
|
279
|
+
self._es.snapshot.status(
|
|
280
|
+
repository=repo_name, snapshot=snapshot_name
|
|
281
|
+
)
|
|
277
282
|
)
|
|
278
283
|
elif repo_name:
|
|
279
|
-
return self._es.snapshot.status(repository=repo_name)
|
|
284
|
+
return dict(self._es.snapshot.status(repository=repo_name))
|
|
280
285
|
else:
|
|
281
|
-
return self._es.snapshot.status()
|
|
286
|
+
return dict(self._es.snapshot.status())
|
|
282
287
|
except Exception as e:
|
|
283
288
|
raise OperationError(f"Failed to get snapshot status: {str(e)}")
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "elastro-client"
|
|
7
|
-
version = "1.3.
|
|
7
|
+
version = "1.3.53"
|
|
8
8
|
description = "A comprehensive Python library for Elasticsearch management with both programmatic and CLI interfaces"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9,<3.14"
|
|
@@ -109,7 +109,7 @@ class TestSnapshotManager:
|
|
|
109
109
|
result = snapshot_manager.create_repository(repo_config)
|
|
110
110
|
assert result is True
|
|
111
111
|
mock_elasticsearch.snapshot.create_repository.assert_called_once_with(
|
|
112
|
-
|
|
112
|
+
name="test-repo",
|
|
113
113
|
body={"type": "fs", "settings": {"location": "/backup/es_snapshots"}},
|
|
114
114
|
)
|
|
115
115
|
|
|
@@ -124,7 +124,7 @@ class TestSnapshotManager:
|
|
|
124
124
|
result = snapshot_manager.create_repository(repo_config)
|
|
125
125
|
assert result is True
|
|
126
126
|
mock_elasticsearch.snapshot.create_repository.assert_called_once_with(
|
|
127
|
-
|
|
127
|
+
name="test-repo",
|
|
128
128
|
body={"type": "fs", "settings": {"location": "/backup/es_snapshots"}},
|
|
129
129
|
)
|
|
130
130
|
|
|
@@ -152,7 +152,7 @@ class TestSnapshotManager:
|
|
|
152
152
|
result = snapshot_manager.delete_repository("test-repo")
|
|
153
153
|
assert result is True
|
|
154
154
|
mock_elasticsearch.snapshot.delete_repository.assert_called_once_with(
|
|
155
|
-
|
|
155
|
+
name="test-repo"
|
|
156
156
|
)
|
|
157
157
|
|
|
158
158
|
def test_delete_repository_error(self, snapshot_manager, mock_elasticsearch):
|
|
@@ -181,7 +181,7 @@ class TestSnapshotManager:
|
|
|
181
181
|
result = snapshot_manager.get_repository("test-repo")
|
|
182
182
|
assert result == mock_response
|
|
183
183
|
mock_elasticsearch.snapshot.get_repository.assert_called_once_with(
|
|
184
|
-
|
|
184
|
+
name="test-repo"
|
|
185
185
|
)
|
|
186
186
|
|
|
187
187
|
def test_get_all_repositories(self, snapshot_manager, mock_elasticsearch):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{elastro_client-1.3.52 → elastro_client-1.3.53}/elastro_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_aggregations_integration.py
RENAMED
|
File without changes
|
{elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_client_integration.py
RENAMED
|
File without changes
|
{elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_datastream_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
{elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_document_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
{elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_query_builder_integration.py
RENAMED
|
File without changes
|
{elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_scroll_integration.py
RENAMED
|
File without changes
|
{elastro_client-1.3.52 → elastro_client-1.3.53}/tests/integration/test_workflow_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|