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