Skip to content

Commit 20661e5

Browse files
committed
Add async compatible classes
1 parent 58c0273 commit 20661e5

28 files changed

+4766
-2194
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ build
88
*.egg
99
coverage.xml
1010
junit.xml
11+
elasticsearch_dsl/_unasync/
1112
test_elasticsearch_dsl/htmlcov
1213
docs/_build
1314
.cache

elasticsearch_dsl/__init__.py

+23
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,26 @@
161161
"token_filter",
162162
"tokenizer",
163163
]
164+
165+
try:
166+
from .document import AsyncDocument # noqa: F401
167+
from .faceted_search import AsyncFacetedSearch # noqa: F401
168+
from .index import AsyncIndex, AsyncIndexTemplate # noqa: F401
169+
from .mapping import AsyncMapping # noqa: F401
170+
from .search import AsyncMultiSearch, AsyncSearch # noqa: F401
171+
from .update_by_query import AsyncUpdateByQuery # noqa: F401
172+
173+
__all__.extend(
174+
[
175+
"AsyncDocument",
176+
"AsyncFacetedSearch",
177+
"AsyncIndex",
178+
"AsyncIndexTemplate",
179+
"AsyncMapping",
180+
"AsyncSearch",
181+
"AsyncMultiSearch",
182+
"AsyncUpdateByQuery",
183+
]
184+
)
185+
except ImportError:
186+
pass

elasticsearch_dsl/_async/__init__.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
try:
19+
from .document import AsyncDocument, AsyncIndexMeta
20+
from .faceted_search import AsyncFacetedSearch
21+
from .index import AsyncIndex, AsyncIndexTemplate
22+
from .search import AsyncMultiSearch, AsyncSearch
23+
from .update_by_query import AsyncUpdateByQuery
24+
25+
__all__ = [
26+
"AsyncDocument",
27+
"AsyncIndexMeta",
28+
"AsyncFacetedSearch",
29+
"AsyncIndex",
30+
"AsyncIndexTemplate",
31+
"AsyncSearch",
32+
"AsyncMultiSearch",
33+
"AsyncUpdateByQuery",
34+
]
35+
except (ImportError, SyntaxError):
36+
pass

0 commit comments

Comments
 (0)