0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-21 18:09:02 +01:00

Drop support for Elasticsearch 5 and 6

This commit is contained in:
Matt Westcott 2023-10-23 17:16:34 +01:00
parent 9acc8c45e7
commit 605c9cf1a6
9 changed files with 9 additions and 2825 deletions

View File

@ -28,9 +28,7 @@ concurrency:
# - django 4.2, python 3.12, postgres:15, parallel, DISABLE_TIMEZONE=yes
# - django stable/5.0.x, python 3.10, postgres (allow failures)
# - django main, python 3.10, postgres:latest, parallel (allow failures)
# - elasticsearch 5, django 3.2, python 3.8, sqlite
# - elasticsearch 6, django 3.2, python 3.8, postgres:latest
# - elasticsearch 7, django 4.1, python 3.8, postgres:latest
# - elasticsearch 7, django 3.2, python 3.8, postgres:latest
# - opensearch 2, django 4.1, python 3.9, sqlite
# - elasticsearch 8, django 4.2, python 3.10, sqlite, USE_EMAIL_USER_MODEL=yes
@ -198,54 +196,6 @@ jobs:
name: coverage-data
path: .coverage.*
# https://github.com/elastic/elastic-github-actions doesn't work for Elasticsearch 5,
# but https://github.com/getong/elasticsearch-action does
test-sqlite-elasticsearch5:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- python: '3.8'
django: 'Django>=3.2,<3.3'
steps:
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- uses: getong/elasticsearch-action@v1.2
with:
elasticsearch version: 5.6.9
host port: 9200
container port: 9200
host node port: 9300
node port: 9300
discovery type: 'single-node'
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e '.[testing]' --config-settings editable_mode=strict
pip install "${{ matrix.django }}"
pip install "elasticsearch>=5,<6"
pip install certifi
- name: Test
run: |
coverage run --parallel-mode --source wagtail runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch5
env:
DATABASE_ENGINE: django.db.backends.sqlite3
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: .coverage.*
test-sqlite-elasticsearch8:
runs-on: ubuntu-latest
strategy:
@ -294,64 +244,6 @@ jobs:
name: coverage-data
path: .coverage.*
# https://github.com/getong/elasticsearch-action doesn't work for Elasticsearch 6,
# but https://github.com/elastic/elastic-github-actions does
test-postgres-elasticsearch6:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- python: '3.8'
django: 'Django>=3.2,<3.3'
services:
postgres:
image: postgres:latest
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 6.8.13
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "psycopg2>=2.6"
pip install -e '.[testing]' --config-settings editable_mode=strict
pip install "${{ matrix.django }}"
pip install "elasticsearch>=6,<7"
pip install certifi
- name: Test
run: |
coverage run --parallel-mode --source wagtail runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch6
env:
DATABASE_ENGINE: django.db.backends.postgresql
DATABASE_HOST: localhost
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
USE_EMAIL_USER_MODEL: ${{ matrix.emailuser }}
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: .coverage.*
test-postgres-elasticsearch7:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
@ -359,7 +251,7 @@ jobs:
matrix:
include:
- python: '3.8'
django: 'Django>=4.1,<4.2'
django: 'Django>=3.2,<3.3'
experimental: false
services:
@ -460,9 +352,7 @@ jobs:
- test-sqlite
- test-postgres
- test-mysql
- test-sqlite-elasticsearch5
- test-sqlite-elasticsearch8
- test-postgres-elasticsearch6
- test-postgres-elasticsearch7
- test-sqlite-opensearch2
runs-on: ubuntu-latest

View File

@ -159,7 +159,7 @@ It is also possible to set `DATABASE_DRIVER`, which corresponds to the `driver`
### Testing Elasticsearch
You can test Wagtail against Elasticsearch by passing the argument `--elasticsearch5`, `--elasticsearch6`, `--elasticsearch7` or `--elasticsearch8` (corresponding to the version of Elasticsearch you want to test against):
You can test Wagtail against Elasticsearch by passing the argument `--elasticsearch7` or `--elasticsearch8` (corresponding to the version of Elasticsearch you want to test against):
```sh
python runtests.py --elasticsearch8

View File

@ -37,6 +37,10 @@ depth: 1
## Upgrade considerations - changes affecting all projects
### Support for Elasticsearch 5 and 6 dropped
The Elasticsearch 5 and 6 backends have been removed. If you are using one of these backends, you will need to upgrade to Elasticsearch 7 or 8 before upgrading to Wagtail 6.0.
## Upgrade considerations - deprecation of old functionality
## Upgrade considerations - changes affecting Wagtail customisations

View File

@ -37,10 +37,6 @@ If you have disabled auto-update, you must run the [](update_index) command on a
## `ATOMIC_REBUILD`
```{warning}
This option may not work on Elasticsearch version 5.4.x, due to [a bug in the handling of aliases](https://github.com/elastic/elasticsearch/issues/24644) - please upgrade to 5.5 or later.
```
By default (when using the Elasticsearch backend), when the `update_index` command is run, Wagtail deletes the index and rebuilds it from scratch. This causes the search engine to not return results until the rebuild is complete and is also risky as you can't roll back if an error occurs.
Setting the `ATOMIC_REBUILD` setting to `True` makes Wagtail rebuild into a separate index while keeping the old index active until the new one is fully built. When the rebuild is finished, the indexes are swapped atomically and the old index is deleted.
@ -62,23 +58,13 @@ This backend is intended to be used for development and also should be good enou
### Elasticsearch Backend
Elasticsearch versions 5, 6, 7 and 8 are supported. Use the appropriate backend for your version:
Elasticsearch versions 7 and 8 are supported. Use the appropriate backend for your version:
- `wagtail.search.backends.elasticsearch5` (Elasticsearch 5.x)
- `wagtail.search.backends.elasticsearch6` (Elasticsearch 6.x)
- `wagtail.search.backends.elasticsearch7` (Elasticsearch 7.x)
- `wagtail.search.backends.elasticsearch8` (Elasticsearch 8.x)
Prerequisites are the [Elasticsearch](https://www.elastic.co/downloads/elasticsearch) service itself and, via pip, the [elasticsearch-py](https://elasticsearch-py.readthedocs.io/) package. The major version of the package must match the installed version of Elasticsearch:
```sh
pip install "elasticsearch>=5.0.0,<6.0.0" # for Elasticsearch 5.x
```
```sh
pip install "elasticsearch>=6.4.0,<7.0.0" # for Elasticsearch 6.x
```
```sh
pip install "elasticsearch>=7.0.0,<8.0.0" # for Elasticsearch 7.x
```
@ -87,10 +73,6 @@ pip install "elasticsearch>=7.0.0,<8.0.0" # for Elasticsearch 7.x
pip install "elasticsearch>=8.0.0,<9.0.0" # for Elasticsearch 8.x
```
```{warning}
Version 6.3.1 of the Elasticsearch client library is incompatible with Wagtail. Use 6.4.0 or above.
```
The backend is configured in settings:
```python

View File

@ -19,8 +19,6 @@ def make_parser():
default="imminent",
)
parser.add_argument("--postgres", action="store_true")
parser.add_argument("--elasticsearch5", action="store_true")
parser.add_argument("--elasticsearch6", action="store_true")
parser.add_argument("--elasticsearch7", action="store_true")
parser.add_argument("--elasticsearch8", action="store_true")
parser.add_argument("--emailuser", action="store_true")
@ -61,12 +59,6 @@ def runtests():
if args.postgres:
os.environ["DATABASE_ENGINE"] = "django.db.backends.postgresql"
if args.elasticsearch5:
os.environ.setdefault("ELASTICSEARCH_URL", "http://localhost:9200")
os.environ.setdefault("ELASTICSEARCH_VERSION", "5")
elif args.elasticsearch6:
os.environ.setdefault("ELASTICSEARCH_URL", "http://localhost:9200")
os.environ.setdefault("ELASTICSEARCH_VERSION", "6")
elif args.elasticsearch7:
os.environ.setdefault("ELASTICSEARCH_URL", "http://localhost:9200")
os.environ.setdefault("ELASTICSEARCH_VERSION", "7")

View File

@ -2,13 +2,11 @@
skipsdist = True
usedevelop = True
envlist = py{38,39,310,311,312}-dj{32,41,42,50stable,main}-{sqlite,postgres,mysql,mssql}-{elasticsearch8,elasticsearch7,elasticsearch6,elasticsearch5,noelasticsearch}-{customuser,emailuser}-{tz,notz},
envlist = py{38,39,310,311,312}-dj{32,41,42,50stable,main}-{sqlite,postgres,mysql,mssql}-{elasticsearch8,elasticsearch7,noelasticsearch}-{customuser,emailuser}-{tz,notz},
[testenv]
install_command = pip install -e ".[testing]" -U {opts} {packages}
commands =
elasticsearch5: coverage run runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch5
elasticsearch6: coverage run runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch6
elasticsearch7: coverage run runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch7
elasticsearch8: coverage run runtests.py wagtail.search wagtail.documents wagtail.images --elasticsearch8
noelasticsearch: coverage run runtests.py {posargs}
@ -32,10 +30,6 @@ deps =
postgres: psycopg2>=2.6
mysql: mysqlclient>=1.4,<2
elasticsearch5: elasticsearch>=5,<6
elasticsearch5: certifi
elasticsearch6: elasticsearch>=6.4.0,<7
elasticsearch6: certifi
elasticsearch7: elasticsearch>=7,<8
elasticsearch7: certifi
elasticsearch8: elasticsearch>=8,<9

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -224,10 +224,6 @@ if "ELASTICSEARCH_URL" in os.environ:
backend = "wagtail.search.backends.elasticsearch8"
elif os.environ.get("ELASTICSEARCH_VERSION") == "7":
backend = "wagtail.search.backends.elasticsearch7"
elif os.environ.get("ELASTICSEARCH_VERSION") == "6":
backend = "wagtail.search.backends.elasticsearch6"
elif os.environ.get("ELASTICSEARCH_VERSION") == "5":
backend = "wagtail.search.backends.elasticsearch5"
WAGTAILSEARCH_BACKENDS["elasticsearch"] = {
"BACKEND": backend,