|
13 | 13 | import certifi
|
14 | 14 |
|
15 | 15 | try:
|
16 |
| - from opensearch_dsl import A, Q, Search |
17 | 16 | from opensearchpy import OpenSearch as Elasticsearch
|
18 |
| - from opensearchpy.exceptions import ConnectionError as ElasticConnectionError |
19 |
| - from opensearchpy.exceptions import NotFoundError, RequestError, TransportError, ConflictError |
| 17 | + from opensearchpy.exceptions import ( |
| 18 | + ConnectionError as ElasticConnectionError, |
| 19 | + TransportError, |
| 20 | + NotFoundError, |
| 21 | + RequestError, |
| 22 | + ConflictError, |
| 23 | + ) |
20 | 24 | from opensearchpy.helpers import BulkIndexError, bulk
|
21 | 25 | except ImportError:
|
22 |
| - from elasticsearch_dsl import Search, Q, A |
23 | 26 | from elasticsearch import Elasticsearch
|
24 | 27 | from elasticsearch.exceptions import (
|
25 | 28 | ConnectionError as ElasticConnectionError,
|
|
30 | 33 | )
|
31 | 34 | from elasticsearch.helpers import BulkIndexError, bulk
|
32 | 35 |
|
| 36 | +try: |
| 37 | + try: |
| 38 | + from opensearchpy import A, Q, Search |
| 39 | + except ImportError: |
| 40 | + from opensearch_dsl import A, Q, Search |
| 41 | +except ImportError: |
| 42 | + from elasticsearch_dsl import Search, Q, A |
| 43 | + |
| 44 | + |
33 | 45 | from DIRAC import S_ERROR, S_OK, gLogger
|
34 | 46 | from DIRAC.Core.Utilities import DErrno, TimeUtilities
|
35 | 47 | from DIRAC.FrameworkSystem.Client.BundleDeliveryClient import BundleDeliveryClient
|
|
0 commit comments