Skip to content

Commit 78fbf1c

Browse files
[REF] connector_elasticsearch: elasticsearch v8 compatibility
1 parent 79983c5 commit 78fbf1c

File tree

7 files changed

+64
-40
lines changed

7 files changed

+64
-40
lines changed

connector_elasticsearch/README.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://odoo-community.org/readme-banner-image
2-
:target: https://odoo-community.org/get-involved?utm_source=readme
3-
:alt: Odoo Community Association
4-
51
=======================
62
connector_elasticsearch
73
=======================
@@ -17,7 +13,7 @@ connector_elasticsearch
1713
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1814
:target: https://odoo-community.org/page/development-status
1915
:alt: Beta
20-
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
2117
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2218
:alt: License: AGPL-3
2319
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsearch--engine-lightgray.png?logo=github
@@ -45,6 +41,12 @@ Elasticsearch_ indexes.
4541
Changelog
4642
=========
4743

44+
16.0.0.3.0
45+
~~~~~~~~~~
46+
47+
* elasticsearch v8 compatibility: The connector now supports Elasticsearch
48+
v8.*.* versions.
49+
4850
12.0.?.?.? (unreleased)
4951
~~~~~~~~~~~~~~~~~~~~~~~
5052

@@ -78,6 +80,7 @@ Contributors
7880
* Raphaël Reverdy <raphael.reverdy@akretion.com>
7981
* Simone Orsi <simone.orsi@camptocamp.com>
8082
* Iván Todorovich <ivan.todorovich@camptocamp.com>
83+
* Thomas Binsfeld <thomas.binsfeld@acsone.eu>
8184

8285
Maintainers
8386
~~~~~~~~~~~

connector_elasticsearch/__manifest__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "connector_elasticsearch",
66
"category": "Connector",
77
"summary": "Connector For Elasticsearch Search Engine",
8-
"version": "16.0.0.2.2",
8+
"version": "16.0.0.3.0",
99
"license": "AGPL-3",
1010
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
1111
"website": "https://github.com/OCA/search-engine",
@@ -15,6 +15,12 @@
1515
],
1616
"demo": ["demo/backend_demo.xml"],
1717
# TODO: Get latest improvements from elasticsearch library
18-
"external_dependencies": {"python": ["elasticsearch>=7.0.0,<=7.13.4", "requests"]},
18+
"external_dependencies": {
19+
"python": [
20+
"elasticsearch>=7.0.0,<9.0.0",
21+
"elastic-transport>=8.15.1,<9.0.0",
22+
"requests",
23+
]
24+
},
1925
"installable": True,
2026
}

connector_elasticsearch/readme/CONTRIBUTORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
* Raphaël Reverdy <raphael.reverdy@akretion.com>
44
* Simone Orsi <simone.orsi@camptocamp.com>
55
* Iván Todorovich <ivan.todorovich@camptocamp.com>
6+
* Thomas Binsfeld <thomas.binsfeld@acsone.eu>

connector_elasticsearch/readme/HISTORY.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
16.0.0.3.0
2+
~~~~~~~~~~
3+
4+
* elasticsearch v8 compatibility: The connector now supports Elasticsearch
5+
v8.*.* versions.
6+
17
12.0.?.?.? (unreleased)
28
~~~~~~~~~~~~~~~~~~~~~~~
39

connector_elasticsearch/static/description/index.html

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>README.rst</title>
6+
<title>connector_elasticsearch</title>
77
<style type="text/css">
88

99
/*
@@ -360,43 +360,46 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document">
363+
<div class="document" id="connector-elasticsearch">
364+
<h1 class="title">connector_elasticsearch</h1>
364365

365-
366-
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367-
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368-
</a>
369-
<div class="section" id="connector-elasticsearch">
370-
<h1>connector_elasticsearch</h1>
371366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
372367
!! This file is generated by oca-gen-addon-readme !!
373368
!! changes will be overwritten. !!
374369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375370
!! source digest: sha256:78a5e739fb7a867f6a968d7a4cae5e9778d3e5b3afa33a598b232e03ceb48b07
376371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/search-engine/tree/16.0/connector_elasticsearch"><img alt="OCA/search-engine" src="https://img.shields.io/badge/github-OCA%2Fsearch--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/search-engine-16-0/search-engine-16-0-connector_elasticsearch"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/search-engine&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/search-engine/tree/16.0/connector_elasticsearch"><img alt="OCA/search-engine" src="https://img.shields.io/badge/github-OCA%2Fsearch--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/search-engine-16-0/search-engine-16-0-connector_elasticsearch"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/search-engine&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378373
<p>This addon provides the bases to implement addons to export information to
379374
<a class="reference external" href="https://www.elastic.co/">Elasticsearch</a> indexes.</p>
380375
<p><strong>Table of contents</strong></p>
381376
<div class="contents local topic" id="contents">
382377
<ul class="simple">
383378
<li><a class="reference internal" href="#changelog" id="toc-entry-1">Changelog</a><ul>
384-
<li><a class="reference internal" href="#unreleased" id="toc-entry-2">12.0.?.?.? (unreleased)</a></li>
379+
<li><a class="reference internal" href="#section-1" id="toc-entry-2">16.0.0.3.0</a></li>
380+
<li><a class="reference internal" href="#unreleased" id="toc-entry-3">12.0.?.?.? (unreleased)</a></li>
385381
</ul>
386382
</li>
387-
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
388-
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
389-
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
390-
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
391-
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
383+
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-4">Bug Tracker</a></li>
384+
<li><a class="reference internal" href="#credits" id="toc-entry-5">Credits</a><ul>
385+
<li><a class="reference internal" href="#authors" id="toc-entry-6">Authors</a></li>
386+
<li><a class="reference internal" href="#contributors" id="toc-entry-7">Contributors</a></li>
387+
<li><a class="reference internal" href="#maintainers" id="toc-entry-8">Maintainers</a></li>
392388
</ul>
393389
</li>
394390
</ul>
395391
</div>
396392
<div class="section" id="changelog">
397-
<h2><a class="toc-backref" href="#toc-entry-1">Changelog</a></h2>
393+
<h1><a class="toc-backref" href="#toc-entry-1">Changelog</a></h1>
394+
<div class="section" id="section-1">
395+
<h2><a class="toc-backref" href="#toc-entry-2">16.0.0.3.0</a></h2>
396+
<ul class="simple">
397+
<li>elasticsearch v8 compatibility: The connector now supports Elasticsearch
398+
v8.*.* versions.</li>
399+
</ul>
400+
</div>
398401
<div class="section" id="unreleased">
399-
<h3><a class="toc-backref" href="#toc-entry-2">12.0.?.?.? (unreleased)</a></h3>
402+
<h2><a class="toc-backref" href="#toc-entry-3">12.0.?.?.? (unreleased)</a></h2>
400403
<ul class="simple">
401404
<li>connector_elasticsearch: Makes the config on index required only if the
402405
index is linked to an elastisearch backend. This change allows the usage
@@ -405,33 +408,34 @@ <h3><a class="toc-backref" href="#toc-entry-2">12.0.?.?.? (unreleased)</a></h3>
405408
</div>
406409
</div>
407410
<div class="section" id="bug-tracker">
408-
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
411+
<h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
409412
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/search-engine/issues">GitHub Issues</a>.
410413
In case of trouble, please check there if your issue has already been reported.
411414
If you spotted it first, help us to smash it by providing a detailed and welcomed
412415
<a class="reference external" href="https://github.com/OCA/search-engine/issues/new?body=module:%20connector_elasticsearch%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
413416
<p>Do not contact contributors directly about support or help with technical issues.</p>
414417
</div>
415418
<div class="section" id="credits">
416-
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
419+
<h1><a class="toc-backref" href="#toc-entry-5">Credits</a></h1>
417420
<div class="section" id="authors">
418-
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
421+
<h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
419422
<ul class="simple">
420423
<li>ACSONE SA/NV</li>
421424
</ul>
422425
</div>
423426
<div class="section" id="contributors">
424-
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
427+
<h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
425428
<ul class="simple">
426429
<li>Laurent Corron &lt;<a class="reference external" href="mailto:laurentcorron&#64;gmail.com">laurentcorron&#64;gmail.com</a>&gt;</li>
427430
<li>Laurent Mignon &lt;<a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a>&gt;</li>
428431
<li>Raphaël Reverdy &lt;<a class="reference external" href="mailto:raphael.reverdy&#64;akretion.com">raphael.reverdy&#64;akretion.com</a>&gt;</li>
429432
<li>Simone Orsi &lt;<a class="reference external" href="mailto:simone.orsi&#64;camptocamp.com">simone.orsi&#64;camptocamp.com</a>&gt;</li>
430433
<li>Iván Todorovich &lt;<a class="reference external" href="mailto:ivan.todorovich&#64;camptocamp.com">ivan.todorovich&#64;camptocamp.com</a>&gt;</li>
434+
<li>Thomas Binsfeld &lt;<a class="reference external" href="mailto:thomas.binsfeld&#64;acsone.eu">thomas.binsfeld&#64;acsone.eu</a>&gt;</li>
431435
</ul>
432436
</div>
433437
<div class="section" id="maintainers">
434-
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
438+
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
435439
<p>This module is maintained by the OCA.</p>
436440
<a class="reference external image-reference" href="https://odoo-community.org">
437441
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -444,6 +448,5 @@ <h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
444448
</div>
445449
</div>
446450
</div>
447-
</div>
448451
</body>
449452
</html>

connector_elasticsearch/tools/adapter.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,18 @@ def _get_es_client(self):
6767
)
6868
if backend.auth_type == "http":
6969
auth = (backend.es_user, backend.es_password)
70-
return elasticsearch.Elasticsearch(
71-
[backend.es_server_host],
72-
http_auth=auth,
73-
use_ssl=backend.ssl,
74-
timeout=max(backend.es_timeout, 1),
75-
retry_on_timeout=backend.es_retry_on_timeout,
76-
max_retries=max(0, backend.es_max_retries),
77-
)
70+
es_kwargs = {
71+
"hosts": [backend.es_server_host],
72+
"http_auth": auth,
73+
"timeout": max(backend.es_timeout, 1),
74+
"retry_on_timeout": backend.es_retry_on_timeout,
75+
"max_retries": max(0, backend.es_max_retries),
76+
}
77+
# Pass use_ssl only if elasticsearch < 8
78+
es_version = elasticsearch.__version__
79+
if es_version and es_version[0] < 8:
80+
es_kwargs["use_ssl"] = backend.ssl
81+
return elasticsearch.Elasticsearch(**es_kwargs)
7882

7983
def test_connection(self):
8084
es = self._es_client
@@ -156,7 +160,7 @@ def each(self) -> Iterator[dict[str, Any]]:
156160

157161
def settings(self) -> None:
158162
es = self._es_client
159-
if not es.indices.exists(self._index_name):
163+
if not es.indices.exists(index=self._index_name):
160164
client = self._es_client
161165
# To allow rolling updates, we work with index aliases
162166
aliased_index_name = self._get_next_aliased_index_name()

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# generated from manifests external_dependencies
2-
elasticsearch>=7.0.0,<=7.13.4
2+
elastic-transport>=8.15.1,<9.0.0
3+
elasticsearch>=7.0.0,<9.0.0
34
pydantic
45
requests
56
typing-extensions

0 commit comments

Comments
 (0)