Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0] fix: removed elastic in favor of opensearch client #7981

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ dependencies:
- cmreshandler >1.0.0b4
- cwltool
- db12
- elasticsearch <7.14
- elasticsearch-dsl
- opensearch-py
- fts3
- gitpython >=2.1.0
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ server =
# (it just installs into site-packages)
# arc
CMRESHandler
elasticsearch <7.14
elasticsearch_dsl
opensearch-py
GitPython
ldap3
apache-libcloud
Expand Down
43 changes: 13 additions & 30 deletions src/DIRAC/Core/Utilities/ElasticSearchDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,22 @@
from urllib import parse as urlparse

import certifi
from opensearchpy import OpenSearch as Elasticsearch
from opensearchpy.exceptions import (
ConflictError,
NotFoundError,
RequestError,
TransportError,
)
from opensearchpy.exceptions import (
ConnectionError as ElasticConnectionError,
)
from opensearchpy.helpers import BulkIndexError, bulk

try:
from opensearchpy import OpenSearch as Elasticsearch
from opensearchpy.exceptions import (
ConflictError,
NotFoundError,
RequestError,
TransportError,
)
from opensearchpy.exceptions import (
ConnectionError as ElasticConnectionError,
)
from opensearchpy.helpers import BulkIndexError, bulk
from opensearchpy import A, Q, Search
except ImportError:
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import (
ConflictError,
NotFoundError,
RequestError,
TransportError,
)
from elasticsearch.exceptions import (
ConnectionError as ElasticConnectionError,
)
from elasticsearch.helpers import BulkIndexError, bulk

try:
try:
from opensearchpy import A, Q, Search
except ImportError:
from opensearch_dsl import A, Q, Search
except ImportError:
from elasticsearch_dsl import A, Q, Search
from opensearch_dsl import A, Q, Search


from DIRAC import S_ERROR, S_OK, gLogger
Expand Down
Loading