Skip to content

Commit 0c5eb3d

Browse files
abkrimclaude
andcommitted
Add dual Elasticsearch 8.x + 9.x support (rebased on v5.4.1)
Update PHP client constraint to ^8.17|^9.0 and CI workflow with matrix testing for both ES 8.18.0 and 9.0.0. Docker images use official docker.elastic.co registry. Mark force_source highlight parameter as deprecated (removed in ES 9.x, deprecated since 8.11). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent af3fbb9 commit 0c5eb3d

5 files changed

Lines changed: 22 additions & 5 deletions

File tree

.github/workflows/run-tests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
jobs:
99
test:
1010
runs-on: ubuntu-22.04
11+
strategy:
12+
matrix:
13+
elasticsearch: ['8.18.0', '9.0.0']
1114
env:
1215
BROADCAST_DRIVER: log
1316
CACHE_DRIVER: redis
@@ -23,7 +26,7 @@ jobs:
2326
# Docs: https://docs.github.com/en/actions/using-containerized-services
2427
services:
2528
elasticsearch:
26-
image: docker.elastic.co/elasticsearch/elasticsearch:8.18.0
29+
image: docker.elastic.co/elasticsearch/elasticsearch:${{ matrix.elasticsearch }}
2730
env:
2831
discovery.type: single-node
2932
xpack.security.enabled: 'false'

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
All notable changes to this `laravel-elasticsearch` package will be documented in this file.
44

5+
## v5.4.2 - 2026-02-24
6+
7+
### Elasticsearch 9.x Compatibility
8+
9+
- **PHP client constraint:** Updated to `^8.17|^9.0` to support both Elasticsearch 8.x and 9.x PHP clients
10+
- **CI matrix:** GitHub Actions now tests against both ES 8.18.0 and 9.0.0 (using official `docker.elastic.co` images)
11+
- **Docker:** Local development uses ES 9.0.0 with official `docker.elastic.co` images
12+
- **Verified compatibility:** Full test suite passes against ES 9.0.0 without code changes
13+
14+
### Deprecation Notice
15+
16+
- `force_source` highlighting parameter is deprecated since ES 8.11 and removed in ES 9.x. The parameter is still accepted for backward compatibility with ES 8.x, but will be ignored by ES 9.x servers
17+
518
## v5.4.1 - 2026-02-23
619

720
### Fixed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"illuminate/database": "^10.30|^11|^12",
2525
"illuminate/events": "^10.0|^11|^12",
2626
"illuminate/support": "^10.0|^11|^12",
27-
"elasticsearch/elasticsearch": "^8.17",
27+
"elasticsearch/elasticsearch": "^8.17|^9.0",
2828
"spatie/ignition": "^1.15",
2929
"pdphilip/omniterm": "^2"
3030
},

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
services:
22
elasticsearch:
3-
image: elasticsearch:8.18.0
3+
image: docker.elastic.co/elasticsearch/elasticsearch:9.0.0
44
ports:
55
- "9200:9200"
66
environment:
77
- discovery.type=single-node
88
- xpack.security.enabled=false
9+
- ES_JAVA_OPTS=-Xms1g -Xmx1g
910
restart: unless-stopped
1011
healthcheck:
1112
test: ["CMD-SHELL", "curl -s http://localhost:9200/_cluster/health | grep -q '\"status\":\"green\"\\|\"status\":\"yellow\"'"]
@@ -17,7 +18,7 @@ services:
1718
depends_on:
1819
elasticsearch:
1920
condition: service_healthy
20-
image: kibana:8.18.0
21+
image: docker.elastic.co/kibana/kibana:8.18.0
2122
restart: unless-stopped
2223
ports:
2324
- "5601:5601"

src/Query/Grammar/Concerns/CompilesOrders.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected function compileHighlight(Builder $builder, mixed $highlight = []): ar
112112
'boundary_scanner_locale',
113113
'encoder',
114114
'fragmenter',
115-
'force_source',
115+
'force_source', // @deprecated Removed in Elasticsearch 9.x. Only works with ES 8.x (deprecated since 8.11)
116116
'fragment_offset',
117117
'fragment_size',
118118
'highlight_query',

0 commit comments

Comments
 (0)