Skip to content

Commit

Permalink
Remove limitation for elasticsearch library (apache#16553)
Browse files Browse the repository at this point in the history
* Remove limitation for elasticsearch library

Elasticsearch <7.6.0 does not work with Python 3.9 (import
errors on deprecated base64 functionality that have been removed
in Python 3.9) see:

ihttps://bugzilla.redhat.com/show_bug.cgi?id=1894188

This PR bumps elasticsearch library version to latest available
(7.13.1 as of this writing) in order to get it Python 3.9
compatible.
  • Loading branch information
potiuk authored Jun 22, 2021
1 parent c6ac2ad commit e5e59b4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ def get_sphinx_theme_version() -> str:
'pydruid>=0.4.1',
]
elasticsearch = [
'elasticsearch>7, <7.6.0',
'elasticsearch-dbapi==0.1.0',
'elasticsearch>7',
'elasticsearch-dbapi',
'elasticsearch-dsl>=5.0.0',
]
exasol = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def info(self, params=None):
'version',
'version_type',
)
def index(self, index, doc_type, body, id=None, params=None):
def index(self, index, doc_type, body, id=None, params=None, headers=None):
if index not in self.__documents_dict:
self.__documents_dict[index] = []

Expand All @@ -98,10 +98,24 @@ def index(self, index, doc_type, body, id=None, params=None):
version = 1

self.__documents_dict[index].append(
{'_type': doc_type, '_id': id, '_source': body, '_index': index, '_version': version}
{
'_type': doc_type,
'_id': id,
'_source': body,
'_index': index,
'_version': version,
'_headers': headers,
}
)

return {'_type': doc_type, '_id': id, 'created': True, '_version': version, '_index': index}
return {
'_type': doc_type,
'_id': id,
'created': True,
'_version': version,
'_index': index,
'_headers': headers,
}

@query_params('parent', 'preference', 'realtime', 'refresh', 'routing')
def exists(self, index, doc_type, id, params=None):
Expand Down Expand Up @@ -198,7 +212,7 @@ def get_source(self, index, doc_type, id, params=None):
'track_scores',
'version',
)
def count(self, index=None, doc_type=None, body=None, params=None):
def count(self, index=None, doc_type=None, body=None, params=None, headers=None):
searchable_indexes = self._normalize_index_to_list(index)
searchable_doc_types = self._normalize_doc_type_to_list(doc_type)

Expand Down Expand Up @@ -247,7 +261,7 @@ def count(self, index=None, doc_type=None, body=None, params=None):
'track_scores',
'version',
)
def search(self, index=None, doc_type=None, body=None, params=None):
def search(self, index=None, doc_type=None, body=None, params=None, headers=None):
searchable_indexes = self._normalize_index_to_list(index)

matches = self._find_match(index, doc_type, body)
Expand Down Expand Up @@ -275,7 +289,7 @@ def search(self, index=None, doc_type=None, body=None, params=None):
@query_params(
'consistency', 'parent', 'refresh', 'replication', 'routing', 'timeout', 'version', 'version_type'
)
def delete(self, index, doc_type, id, params=None):
def delete(self, index, doc_type, id, params=None, headers=None):

found = False

Expand Down

0 comments on commit e5e59b4

Please sign in to comment.