Skip to content

Commit 9764113

Browse files
more fixes
1 parent 6d4ea49 commit 9764113

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

elasticsearch/dsl/_async/document.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ def search(
126126
Create an :class:`~elasticsearch.dsl.Search` instance that will search
127127
over this ``Document``.
128128
"""
129-
s = AsyncSearch(
129+
s = AsyncSearch[Self](
130130
using=cls._get_using(using), index=cls._default_index(index), doc_type=[cls]
131131
)
132-
return s.source(cls._get_field_names())
132+
return s.source(cls._get_field_names()) # type: ignore[arg-type]
133133

134134
@classmethod
135135
async def get(

elasticsearch/dsl/_sync/document.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ def search(
120120
Create an :class:`~elasticsearch.dsl.Search` instance that will search
121121
over this ``Document``.
122122
"""
123-
s = Search(
123+
s = Search[Self](
124124
using=cls._get_using(using), index=cls._default_index(index), doc_type=[cls]
125125
)
126-
return s.source(cls._get_field_names())
126+
return s.source(cls._get_field_names()) # type: ignore[arg-type]
127127

128128
@classmethod
129129
def get(

test_elasticsearch/test_dsl/test_integration/_async/test_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ async def test_inner_hits_are_serialized_to_dict(
135135

136136
@pytest.mark.anyio
137137
async def test_scan_respects_doc_types(async_data_client: AsyncElasticsearch) -> None:
138-
repos = [repo async for repo in Repository.search().scan()]
138+
repos = [repo async for repo in Repository.search().source("organization").scan()]
139139

140140
assert 1 == len(repos)
141141
assert isinstance(repos[0], Repository)

test_elasticsearch/test_dsl/test_integration/_sync/test_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def test_inner_hits_are_serialized_to_dict(
135135

136136
@pytest.mark.sync
137137
def test_scan_respects_doc_types(data_client: Elasticsearch) -> None:
138-
repos = [repo for repo in Repository.search().scan()]
138+
repos = [repo for repo in Repository.search().source("organization").scan()]
139139

140140
assert 1 == len(repos)
141141
assert isinstance(repos[0], Repository)

0 commit comments

Comments
 (0)