Skip to content

Commit

Permalink
Fix DeprecationWarning's from elasticsearch-py.
Browse files Browse the repository at this point in the history
  • Loading branch information
arnau126 committed Jan 14, 2022
1 parent 620ddc8 commit 7de7a5f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
7 changes: 7 additions & 0 deletions Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Changelog
=========

7.4.1 (?)
------------------

* Fixed DeprecationWarning from elasticsearch-py (`#1558_`)

.. _#1558: https://github.com/elastic/elasticsearch-dsl-py/pull/1558

7.4.0 (2021-07-15)
------------------

Expand Down
22 changes: 10 additions & 12 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,20 @@ Let's have a typical search request written directly as a ``dict``:

response = client.search(
index="my-index",
body={
"query": {
query={
"bool": {
"must": [{"match": {"title": "python"}}],
"must_not": [{"match": {"description": "beta"}}],
"filter": [{"term": {"category": "search"}}]
"must": [{"match": {"title": "python"}}],
"must_not": [{"match": {"description": "beta"}}],
"filter": [{"term": {"category": "search"}}]
}
},
"aggs" : {
},
aggs={
"per_tag": {
"terms": {"field": "tags"},
"aggs": {
"max_lines": {"max": {"field": "lines"}}
}
"terms": {"field": "tags"},
"aggs": {
"max_lines": {"max": {"field": "lines"}}
}
}
}
}
)

Expand Down
2 changes: 1 addition & 1 deletion elasticsearch_dsl/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ def save(
doc_meta.update(kwargs)
meta = es.index(
index=self._get_index(index),
body=self.to_dict(skip_empty=skip_empty),
document=self.to_dict(skip_empty=skip_empty),
**doc_meta
)
# update meta information from ES
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch_dsl/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def create(self, using=None, **kwargs):
``Elasticsearch.indices.create`` unchanged.
"""
return self._get_connection(using).indices.create(
index=self._name, body=self.to_dict(), **kwargs
index=self._name, **self.to_dict(), **kwargs
)

def is_closed(self, using=None):
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch_dsl/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ def execute(self, ignore_cache=False):
es = get_connection(self._using)

self._response = self._response_class(
self, es.search(index=self._index, body=self.to_dict(), **self._params)
self, es.search(index=self._index, **self.to_dict(), **self._params)
)
return self._response

Expand Down

0 comments on commit 7de7a5f

Please sign in to comment.