1
0
mirror of synced 2026-07-05 17:50:00 +00:00

Compare commits

..

50 Commits

Author SHA1 Message Date
Christoph Strobl 97939f58dc Release version 6.0.6 (2025.1.6).
See #3276
2026-06-09 10:50:10 +02:00
Mark Paluch 8bccf42d9c Upgrade to Maven Wrapper 3.9.16.
See #3292
2026-06-02 14:57:30 +02:00
Mark Paluch ccb5016928 Refine GitHub Actions workflows.
See #3276
2026-06-02 09:21:52 +02:00
Mark Paluch 3757d9d1d6 After release cleanups.
See #3257
2026-04-17 16:41:58 +02:00
Mark Paluch 4796629f6e Prepare next development iteration.
See #3257
2026-04-17 16:41:57 +02:00
Mark Paluch dde239cab6 Release version 6.0.5 (2025.1.5).
See #3257
2026-04-17 16:39:32 +02:00
Mark Paluch f34dbb1915 Prepare 6.0.5 (2025.1.5).
See #3257
2026-04-17 16:39:11 +02:00
Peter-Josef Meisch 8875fb79a8 Upgrade to Elasticsearch 9.2.8 - the missing parts (#3271)
Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
2026-04-11 12:31:55 +02:00
Mark Paluch f6af6b6f33 Upgrade to Elasticsearch REST Client 9.2.8.
See #3269
2026-04-10 16:58:21 +02:00
Ralph Ursprung 6b3646bcc1 Make AOT hints for ELC optional.
see also opensearch-project/spring-data-opensearch#441

Signed-off-by: Ralph Ursprung <Ralph.Ursprung@avaloq.com>
(cherry picked from commit ffdbea4dba)
2026-03-31 18:20:14 +02:00
Peter-Josef Meisch 1cccc1cbb2 Ugrade Elasticsearch to version 9.2.7.
Closes #3264

Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
2026-03-22 17:04:39 +01:00
Mark Paluch 2c8e18ac35 After release cleanups.
See #3245
2026-03-13 11:38:31 +01:00
Mark Paluch c11146b0f2 Prepare next development iteration.
See #3245
2026-03-13 11:38:30 +01:00
Mark Paluch 01be7415db Release version 6.0.4 (2025.1.4).
See #3245
2026-03-13 11:35:34 +01:00
Mark Paluch 77c596ec01 Prepare 6.0.4 (2025.1.4).
See #3245
2026-03-13 11:35:09 +01:00
Peter-Josef Meisch 7f68f50e56 Upgrade to Elasticsearch 9.2.6
Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
2026-03-01 12:29:10 +01:00
Mark Paluch 89b3199c3f Update GitHub action branch triggers.
See #3245
2026-02-20 17:49:59 +01:00
Mark Paluch ad77924370 Refine Antora-build.
See spring-projects/spring-data-build#2797
2026-02-20 17:17:36 +01:00
Mark Paluch ce54645bbe Update GitHub action branch triggers.
See #3245
2026-02-19 14:46:36 +01:00
Christoph Strobl 93363c9e04 Remove obsolete CI configuration.
See spring-projects/spring-data-build#2764
2026-02-16 16:43:27 +01:00
Mark Paluch da40eb1b11 Add GitHub actions.
See spring-projects/spring-data-build#2764
2026-02-16 16:42:10 +01:00
noel1155 911d80e77e Fix error propagation in AbstractReactiveElasticsearchTemplate:save()
Previously, errors occurring during the saveAll operation within the reactive save method were swallowed because the inner subscriber did not have an error handler. This caused the Flux to hang indefinitely instead of terminating with an error.

This commit adds an error handler to the inner subscriber that:
1. Cancels the upstream subscription to prevent further processing.
2. Propagates the error to the sink, allowing the caller to receive the error signal.
3. Updates the map operation to return the entity for better debugging capability.

Signed-off-by: Noel F <noel@Noels-MacBook-Pro.local>

* Add test for error propagation in reactive Flux save operations

This test verifies that errors occurring during saveAll operations
with a Flux are properly propagated to the subscriber instead of
being swallowed. The test creates a Flux that emits valid entities
followed by an error, and confirms the error reaches the caller.

Signed-off-by: Noel F <noel@Noels-MacBook-Pro.local>

* undo format fixes

Signed-off-by: Noel F <noel@Noels-MacBook-Pro.local>

* Update error propagation test: expect 0 entities before error due to race condition

The manual subscriber's onError fires before in-flight saveAll can push
results through tryEmitNext, so the caller sees 0 entities before the error.
Updated test expectation and added clarifying comment.

Signed-off-by: Noel F <noel@Noels-MacBook-Pro.local>

---------

Signed-off-by: Noel F <noel@Noels-MacBook-Pro.local>
Co-authored-by: xylos19 <noel@Noels-MacBook-Pro.local>

Closes #3233

(cherry picked from commit 0c1f5369df)
2026-02-15 08:41:13 +01:00
Mark Paluch bd8f947a47 After release cleanups.
See #3226
2026-02-13 11:18:07 +01:00
Mark Paluch 9af8e2970a Prepare next development iteration.
See #3226
2026-02-13 11:18:06 +01:00
Mark Paluch 3a295cfa12 Release version 6.0.3 (2025.1.3).
See #3226
2026-02-13 11:15:46 +01:00
Mark Paluch efe7932d42 Prepare 6.0.3 (2025.1.3).
See #3226
2026-02-13 11:15:27 +01:00
Peter-Josef Meisch 26a7b48c4b Upgrade to Elasticsearch 9.2.5.
Closes #3236

Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
2026-02-08 18:24:59 +01:00
Peter-Josef Meisch 34a0d9b600 Fix setting script id in UpdateQuery request.
Closes #3231

Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
(cherry picked from commit ead1926d13)
2026-02-01 13:39:36 +01:00
Mark Paluch cb32d1991d Update CI Properties.
See #3226
2026-01-28 10:41:14 +01:00
Peter-Josef Meisch fbf9c355fa Upgrade to Elasticsearch 9.2.4. (#3229)
Closes #3228

Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
2026-01-23 19:53:00 +01:00
Christoph Strobl 2dbca48cdf After release cleanups.
See #3214
2026-01-16 10:39:48 +01:00
Christoph Strobl e7366973b7 Prepare next development iteration.
See #3214
2026-01-16 10:39:47 +01:00
Christoph Strobl 53ac53d146 Release version 6.0.2 (2025.1.2).
See #3214
2026-01-16 10:36:18 +01:00
Christoph Strobl 6c656dff17 Prepare 6.0.2 (2025.1.2).
See #3214
2026-01-16 10:35:37 +01:00
Mark Paluch cfa303c6a3 Add Readme templates.
See spring-projects/spring-data-build#2758
2026-01-12 15:27:26 +01:00
Mark Paluch 353c463aa8 Extend license header copyright years to present.
See #3221
2026-01-05 08:45:42 +01:00
Peter-Josef Meisch cb67bfb534 Upgrade to Elasticsearch 9.2.3.
Closes #3217

Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
2025-12-24 16:21:03 +01:00
Mark Paluch 49cce254ce After release cleanups.
See #3197
2025-12-12 12:22:56 +01:00
Mark Paluch 597409c4c2 Prepare next development iteration.
See #3197
2025-12-12 12:22:55 +01:00
Mark Paluch 66144d10f8 Release version 6.0.1 (2025.1.1).
See #3197
2025-12-12 12:20:35 +01:00
Mark Paluch e6aefc8180 Prepare 6.0.1 (2025.1.1).
See #3197
2025-12-12 12:20:16 +01:00
Mark Paluch a7bd311106 Polishing.
Simplify test dependency setup, remove no longer required servlet/xbean dependencies, exclude commons-lang3 in favor of the Testcontainers variant. Remove outdated commons-codec dependency in favor of the Testcontainers variant.

See #3212
2025-12-11 09:02:48 +01:00
Mark Paluch 003d75f022 Add @ContextConfiguration(…) to test classes that use @SpringIntegrationTest on super classes.
Closes #3212
2025-12-11 09:02:48 +01:00
Mark Paluch 535b407085 Update CI Properties.
See #3197
2025-12-10 08:35:04 +01:00
Peter-Josef Meisch 44919d4cbe Upgrade Elasticsearch to 9.2.2.
Close #3208

Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
2025-12-05 00:01:14 +01:00
Peter-Josef Meisch 6260f278ba Fix UpdateQuery.Builder to allow only a scriptname to be set.
Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
(cherry picked from commit 69746441e1)
2025-12-04 23:25:34 +01:00
Peter-Josef Meisch b3bd77aa46 Adjust aot hints for Elasticsearch 9 client.
The hints for the old httpclient are only needed when the old library is on the classpath, in case a user still uses the old RestClient. For the new Elasticsearch client there are no aot hints required.

Closes: #3203

Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
(cherry picked from commit e31b66768b)
2025-11-25 20:11:04 +01:00
Peter-Josef Meisch bea651bc95 Fix documentation.
Closes #3199

Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
(cherry picked from commit 5821a81db9)
2025-11-14 19:02:47 +01:00
Mark Paluch 175614cd94 After release cleanups.
See #3186
2025-11-14 13:56:30 +01:00
Mark Paluch c4c73709c8 Prepare next development iteration.
See #3186
2025-11-14 13:56:29 +01:00
46 changed files with 359 additions and 681 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
= Spring Data for Elasticsearch image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-elasticsearch%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-elasticsearch/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]] image:https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A["Revved up by Develocity", link="https://ge.spring.io/scans?search.rootProjectNames=Spring Data Elasticsearch"]
= Spring Data for Elasticsearch image:https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A["Revved up by Develocity", link="https://ge.spring.io/scans?search.rootProjectNames=Spring Data Elasticsearch"]
The primary goal of the https://projects.spring.io/spring-data[Spring Data] project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.
+29
View File
@@ -0,0 +1,29 @@
name: CI Build
on:
workflow_dispatch:
push:
branches: [ 6.0.x, 'issue/6.0.x/**' ]
permissions: read-all
jobs:
build-java:
strategy:
matrix:
java-version: [ base, main ]
name: Build project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Java and Maven
uses: spring-projects/spring-data-build/actions/setup-maven@4.0.x
with:
java-version: ${{ matrix.java-version }}
develocity-access-key: '${{ secrets.DEVELOCITY_ACCESS_KEY }}'
- name: Build
uses: spring-projects/spring-data-build/actions/maven-build@4.0.x
env:
TESTCONTAINERS_REUSE_ENABLE: true
with:
settings-xml: '${{ vars.SETTINGS_XML }}'
+45
View File
@@ -0,0 +1,45 @@
# GitHub Actions to automate GitHub issues for Spring Data Project Management
name: Spring Data GitHub Issues
on:
issues:
types: [opened, edited, reopened]
issue_comment:
types: [created]
pull_request_target:
types: [opened, edited, reopened]
permissions:
contents: read
issues: write
pull-requests: write
jobs:
Inbox:
runs-on: ubuntu-latest
if: vars.PROJECT_CARDS_ENABLED == 'true' && github.repository_owner == 'spring-projects' && (github.event.action == 'opened' || github.event.action == 'reopened') && github.event.pull_request == null && !contains(join(github.event.issue.labels.*.name, ', '), 'dependency-upgrade') && !contains(github.event.issue.title, 'Release ')
steps:
- name: Create or Update Issue Card
uses: actions/add-to-project@v1.0.2
with:
project-url: https://github.com/orgs/spring-projects/projects/25
github-token: ${{ secrets.GH_ISSUES_TOKEN_SPRING_DATA }}
Pull-Request:
runs-on: ubuntu-latest
if: vars.PROJECT_CARDS_ENABLED == 'true' && github.repository_owner == 'spring-projects' && (github.event.action == 'opened' || github.event.action == 'reopened') && github.event.pull_request != null
steps:
- name: Create or Update Pull Request Card
uses: actions/add-to-project@v1.0.2
with:
project-url: https://github.com/orgs/spring-projects/projects/25
github-token: ${{ secrets.GH_ISSUES_TOKEN_SPRING_DATA }}
Feedback-Provided:
runs-on: ubuntu-latest
if: vars.PROJECT_CARDS_ENABLED == 'true' && github.repository_owner == 'spring-projects' && github.event_name == 'issue_comment' && github.event.action == 'created' && github.actor != 'spring-projects-issues' && github.event.pull_request == null && github.event.issue.state == 'open' && contains(toJSON(github.event.issue.labels), 'waiting-for-feedback')
steps:
- name: Update Project Card
uses: actions/add-to-project@v1.0.2
with:
project-url: https://github.com/orgs/spring-projects/projects/25
github-token: ${{ secrets.GH_ISSUES_TOKEN_SPRING_DATA }}
+32
View File
@@ -0,0 +1,32 @@
name: Snapshots
on:
workflow_dispatch:
push:
branches: [ 6.0.x, 'issue/6.0.x/**' ]
permissions: read-all
jobs:
build-snapshots:
name: Build and deploy snapshots
if: ${{ github.repository_owner == 'spring-projects' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Java and Maven
uses: spring-projects/spring-data-build/actions/setup-maven@4.0.x
with:
develocity-access-key: '${{ secrets.DEVELOCITY_ACCESS_KEY }}'
- name: Deploy to Artifactory
uses: spring-projects/spring-data-build/actions/maven-artifactory-deploy@4.0.x
env:
TESTCONTAINERS_REUSE_ENABLE: true
with:
build-name: 'spring-data-elasticsearch'
username: '${{ secrets.ARTIFACTORY_USERNAME }}'
password: '${{ secrets.ARTIFACTORY_PASSWORD }}'
context-url: '${{ vars.ARTIFACTORY_CONTEXT_URL }}'
repository: '${{ vars.ARTIFACTORY_REPOSITORY }}'
project: '${{ vars.ARTIFACTORY_PROJECT }}'
settings-xml: '${{ vars.SETTINGS_XML }}'
+2 -2
View File
@@ -1,3 +1,3 @@
#Thu Jul 17 13:59:56 CEST 2025
#Tue Jun 02 14:59:45 CEST 2026
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.16/apache-maven-3.9.16-bin.zip
wrapperUrl=https\://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip
+1 -39
View File
@@ -1,43 +1,5 @@
= Continuous Integration
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-elasticsearch%2Fmain&subject=2020.0.0%20(main)[link=https://jenkins.spring.io/view/SpringData/job/spring-data-elasticsearch/]
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-elasticsearch%2F4.0.x&subject=Neumann%20(4.0.x)[link=https://jenkins.spring.io/view/SpringData/job/spring-data-elasticsearch/]
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-elasticsearch%2F3.2.x&subject=Moore%20(3.2.x)[link=https://jenkins.spring.io/view/SpringData/job/spring-data-elasticsearch/]
== Running CI tasks locally
Since this pipeline is purely Docker-based, it's easy to:
* Debug what went wrong on your local machine.
* Test out a a tweak to your `verify.sh` script before sending it out.
* Experiment against a new image before submitting your pull request.
All of these use cases are great reasons to essentially run what the CI server does on your local machine.
IMPORTANT: To do this you must have Docker installed on your machine.
1. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-data-elasticsearch-github adoptopenjdk/openjdk8:latest /bin/bash`
+
This will launch the Docker image and mount your source code at `spring-data-elasticsearch-github`.
+
2. `cd spring-data-elasticsearch-github`
+
Next, run your tests from inside the container:
+
3. `./mvnw clean dependency:list test -Dsort` (or whatever profile you need to test out)
Since the container is binding to your source, you can make edits from your IDE and continue to run build jobs.
If you need to package things up, do this:
1. `docker run -it -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source="$(pwd)",target=/spring-data-elasticsearch-github adoptopenjdk/openjdk8:latest /bin/bash`
+
This will launch the Docker image and mount your source code at `spring-data-elasticsearch-github`.
+
2. `cd spring-data-elasticsearch-github`
+
Next, try to package everything up from inside the container:
+
3. `./mvnw -Pci,snapshot -Dmaven.test.skip=true clean package`
NOTE: Docker containers can eat up disk space fast! From time to time, run `docker system prune` to clean out old images.
You can run CI jobs locally using Docker and act[https://nektosact.com/].
Vendored
-132
View File
@@ -1,132 +0,0 @@
def p = [:]
node {
checkout scm
p = readProperties interpolate: true, file: 'ci/pipeline.properties'
}
pipeline {
agent none
triggers {
pollSCM 'H/10 * * * *'
upstream(upstreamProjects: "spring-data-commons/main", threshold: hudson.model.Result.SUCCESS)
}
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '14'))
}
stages {
stage("test: baseline (main)") {
when {
beforeAgent(true)
anyOf {
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
not { triggeredBy 'UpstreamCause' }
}
}
agent {
label 'data'
}
options { timeout(time: 30, unit: 'MINUTES') }
environment {
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
}
steps {
script {
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
sh "PROFILE=none JENKINS_USER_NAME=${p['jenkins.user.name']} ci/verify.sh"
sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh"
}
}
}
}
}
stage("Test other configurations") {
when {
beforeAgent(true)
allOf {
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
not { triggeredBy 'UpstreamCause' }
}
}
parallel {
stage("test: baseline (next)") {
agent {
label 'data'
}
options { timeout(time: 30, unit: 'MINUTES') }
environment {
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
}
steps {
script {
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) {
sh "PROFILE=none JENKINS_USER_NAME=${p['jenkins.user.name']} ci/verify.sh"
sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh"
}
}
}
}
}
}
}
stage('Release to artifactory') {
when {
beforeAgent(true)
anyOf {
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
not { triggeredBy 'UpstreamCause' }
}
}
agent {
label 'data'
}
options { timeout(time: 20, unit: 'MINUTES') }
environment {
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
}
steps {
script {
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
"./mvnw -s settings.xml -Pci,artifactory " +
"-Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root " +
"-Dartifactory.server=${p['artifactory.url']} " +
"-Dartifactory.username=${ARTIFACTORY_USR} " +
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
"-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " +
"-Dartifactory.build-name=spring-data-elasticsearch " +
"-Dartifactory.build-number=spring-data-elasticsearch-${BRANCH_NAME}-build-${BUILD_NUMBER} " +
"-Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch " +
"-Dmaven.test.skip=true clean deploy -U -B"
}
}
}
}
}
}
post {
changed {
script {
emailext(
subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}",
mimeType: 'text/html',
recipientProviders: [[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']],
body: "<a href=\"${env.BUILD_URL}\">${currentBuild.fullDisplayName} is reported as ${currentBuild.currentResult}</a>")
}
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
= Spring Data for Elasticsearch image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-elasticsearch%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-elasticsearch/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]] image:https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A["Revved up by Develocity", link="https://ge.spring.io/scans?search.rootProjectNames=Spring Data Elasticsearch"]
= Spring Data for Elasticsearch image:https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A["Revved up by Develocity", link="https://ge.spring.io/scans?search.rootProjectNames=Spring Data Elasticsearch"]
The primary goal of the https://projects.spring.io/spring-data[Spring Data] project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.
-8
View File
@@ -1,8 +0,0 @@
#!/bin/bash -x
set -euo pipefail
export JENKINS_USER=${JENKINS_USER_NAME}
MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \
./mvnw -s settings.xml clean -Dscan=false -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root
-33
View File
@@ -1,33 +0,0 @@
# Java versions
java.main.tag=25.0.1_8-jdk-noble
java.next.tag=25.0.1_8-jdk-noble
# Docker container images - standard
docker.java.main.image=library/eclipse-temurin:${java.main.tag}
docker.java.next.image=library/eclipse-temurin:${java.next.tag}
# Supported versions of MongoDB
docker.mongodb.6.0.version=6.0.23
docker.mongodb.7.0.version=7.0.20
docker.mongodb.8.0.version=8.0.9
# Supported versions of Redis
docker.redis.6.version=6.2.13
docker.redis.7.version=7.2.4
docker.redis.8.version=8.2.2
docker.valkey.8.version=8.1.1
# Docker environment settings
docker.java.inside.basic=-v $HOME:/tmp/jenkins-home --ulimit nofile=32000:32000
docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home --ulimit nofile=32000:32000
# Credentials
docker.registry=
docker.credentials=hub.docker.com-springbuildmaster
docker.proxy.registry=https://docker-hub.usw1.packages.broadcom.com
docker.proxy.credentials=usw1_packages_broadcom_com-jenkins-token
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c
artifactory.url=https://repo.spring.io
artifactory.repository.snapshot=libs-snapshot-local
develocity.access-key=gradle_enterprise_secret_access_key
jenkins.user.name=spring-builds+jenkins
-10
View File
@@ -1,10 +0,0 @@
#!/bin/bash -x
set -euo pipefail
mkdir -p /tmp/jenkins-home/.m2/spring-data-elasticsearch
export JENKINS_USER=${JENKINS_USER_NAME}
MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \
./mvnw -s settings.xml \
-P${PROFILE} clean dependency:list verify -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root
+8 -22
View File
@@ -5,12 +5,12 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>6.1.0-M1</version>
<version>6.0.6</version>
<parent>
<groupId>org.springframework.data.build</groupId>
<artifactId>spring-data-parent</artifactId>
<version>4.1.0-M1</version>
<version>4.0.6</version>
</parent>
<name>Spring Data Elasticsearch</name>
@@ -18,14 +18,14 @@
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>
<properties>
<springdata.commons>4.1.0-M1</springdata.commons>
<springdata.commons>4.0.6</springdata.commons>
<!-- version of the ElasticsearchClient -->
<elasticsearch-java>9.2.5</elasticsearch-java>
<elasticsearch-rest-client>9.2.5</elasticsearch-rest-client>
<elasticsearch-java>9.2.8</elasticsearch-java>
<elasticsearch-rest-client>9.2.8</elasticsearch-rest-client>
<hoverfly>0.20.2</hoverfly>
<log4j>2.25.3</log4j>
<log4j>2.25.1</log4j>
<jsonassert>1.5.3</jsonassert>
<wiremock>3.9.2</wiremock>
@@ -82,8 +82,7 @@
<scm>
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>
<connection>scm:git:git://github.com/spring-projects/spring-data-elasticsearch.git</connection>
<developerConnection>scm:git:ssh://git@github.com/spring-projects/spring-data-elasticsearch.git
</developerConnection>
<developerConnection>scm:git:ssh://git@github.com/spring-projects/spring-data-elasticsearch.git</developerConnection>
</scm>
<issueManagement>
@@ -179,30 +178,17 @@
</dependency>
<!-- Jackson JSON Mapper -->
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- Version 2 to use with the legacy RestClient -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<!-- CDI -->
<dependency>
<groupId>javax.interceptor</groupId>
<artifactId>javax.interceptor-api</artifactId>
-29
View File
@@ -1,29 +0,0 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>spring-plugins-release</id>
<username>${env.ARTIFACTORY_USR}</username>
<password>${env.ARTIFACTORY_PSW}</password>
</server>
<server>
<id>spring-libs-snapshot</id>
<username>${env.ARTIFACTORY_USR}</username>
<password>${env.ARTIFACTORY_PSW}</password>
</server>
<server>
<id>spring-libs-milestone</id>
<username>${env.ARTIFACTORY_USR}</username>
<password>${env.ARTIFACTORY_PSW}</password>
</server>
<server>
<id>spring-libs-release</id>
<username>${env.ARTIFACTORY_USR}</username>
<password>${env.ARTIFACTORY_PSW}</password>
</server>
</servers>
</settings>
+3 -7
View File
@@ -6,12 +6,8 @@ nav:
ext:
collector:
- run:
command: ./mvnw validate process-resources -am -Pantora-process-resources
command: ./mvnw -B validate process-resources dependency:unpack -am -Pantora-process-resources
local: true
scan:
dir: target/classes/
- run:
command: ./mvnw package -Pdistribute
local: true
scan:
dir: target/antora
- dir: target/classes/
- dir: target/antora/
@@ -1,18 +1,12 @@
[[new-features]]
= What's new
[[new-features.6-1-0]]
== New in Spring Data Elasticsearch 6.1
* Upgrade to Elasticsearch 9.2.5
* Add support to use `IndexCoordinates` as repository query parameter
[[new-features.6-0-0]]
== New in Spring Data Elasticsearch 6.0
* Upgrade to Spring 7
* Switch to jspecify nullability annotations
* Upgrade to Elasticsearch 9.2.1
* Upgrade to Elasticsearch 9.2.2
* Use the new Elasticsearch Rest5Client as default
* Add support for SpEL expressions in the `settingPath` parameter of the `@Setting` annotation
@@ -6,8 +6,7 @@ The following table shows the Elasticsearch and Spring versions that are used by
[cols="^,^,^,^",options="header"]
|===
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework
| 2026.0 | 6.1.x | 9.2.5 | 7.0.x
| 2025.1 | 6.0.x | 9.2.2 | 7.0.x
| 2025.1 | 6.0.x | 9.2.8 | 7.0.x
| 2025.0 | 5.5.x | 8.18.1 | 6.2.x
| 2024.1 | 5.4.xfootnote:oom[Out of maintenance] | 8.15.5 | 6.1.x
| 2024.0 | 5.3.xfootnote:oom[] | 8.13.4 | 6.1.x
@@ -17,14 +17,12 @@ package org.springframework.data.elasticsearch.client.elc;
import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.json.JsonpMapper;
import co.elastic.clients.json.jackson.Jackson3JsonpMapper;
import co.elastic.clients.json.jackson.JacksonJsonpMapper;
import co.elastic.clients.transport.ElasticsearchTransport;
import co.elastic.clients.transport.TransportOptions;
import co.elastic.clients.transport.rest5_client.Rest5ClientOptions;
import co.elastic.clients.transport.rest5_client.low_level.RequestOptions;
import co.elastic.clients.transport.rest5_client.low_level.Rest5Client;
import tools.jackson.databind.cfg.JsonNodeFeature;
import tools.jackson.databind.json.JsonMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
@@ -34,6 +32,10 @@ import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
import org.springframework.util.Assert;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
/**
* Base class for a @{@link org.springframework.context.annotation.Configuration} class to set up the Elasticsearch
* connection using the Elasticsearch Client. This class exposes different parts of the setup as Spring beans. Deriving
@@ -126,11 +128,10 @@ public abstract class ElasticsearchConfiguration extends ElasticsearchConfigurat
// we need to create our own objectMapper that keeps null values in order to provide the storeNullValue
// functionality. The one Elasticsearch would provide removes the nulls. We remove unwanted nulls before they get
// into this mapper, so we can safely keep them here.
JsonMapper jsonMapper = JsonMapper.builder()
.enable(JsonNodeFeature.WRITE_NULL_PROPERTIES)
.enable(JsonNodeFeature.READ_NULL_PROPERTIES)
.build();
return new Jackson3JsonpMapper(jsonMapper);
var objectMapper = (new ObjectMapper())
.configure(SerializationFeature.INDENT_OUTPUT, false)
.setSerializationInclusion(JsonInclude.Include.ALWAYS);
return new JacksonJsonpMapper(objectMapper);
}
/**
@@ -47,7 +47,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
* @since 4.4
* @deprecated since 6.0, use {@link ElasticsearchConfiguration}
*/
@Deprecated(since = "6.0", forRemoval = true)
@Deprecated(since = "6.0", forRemoval=true)
public abstract class ElasticsearchLegacyRestClientConfiguration extends ElasticsearchConfigurationSupport {
/**
@@ -16,14 +16,12 @@
package org.springframework.data.elasticsearch.client.elc;
import co.elastic.clients.json.JsonpMapper;
import co.elastic.clients.json.jackson.Jackson3JsonpMapper;
import co.elastic.clients.json.jackson.JacksonJsonpMapper;
import co.elastic.clients.transport.ElasticsearchTransport;
import co.elastic.clients.transport.TransportOptions;
import co.elastic.clients.transport.rest5_client.Rest5ClientOptions;
import co.elastic.clients.transport.rest5_client.low_level.RequestOptions;
import co.elastic.clients.transport.rest5_client.low_level.Rest5Client;
import tools.jackson.databind.cfg.JsonNodeFeature;
import tools.jackson.databind.json.JsonMapper;
import org.elasticsearch.client.RestClient;
import org.springframework.context.annotation.Bean;
@@ -34,6 +32,10 @@ import org.springframework.data.elasticsearch.core.ReactiveElasticsearchOperatio
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
import org.springframework.util.Assert;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
/**
* Base class for a @{@link org.springframework.context.annotation.Configuration} class to set up the Elasticsearch
* connection using the {@link ReactiveElasticsearchClient}. This class exposes different parts of the setup as Spring
@@ -125,11 +127,10 @@ public abstract class ReactiveElasticsearchConfiguration extends ElasticsearchCo
// we need to create our own objectMapper that keeps null values in order to provide the storeNullValue
// functionality. The one Elasticsearch would provide removes the nulls. We remove unwanted nulls before they get
// into this mapper, so we can safely keep them here.
JsonMapper jsonMapper = JsonMapper.builder()
.enable(JsonNodeFeature.WRITE_NULL_PROPERTIES)
.enable(JsonNodeFeature.READ_NULL_PROPERTIES)
.build();
return new Jackson3JsonpMapper(jsonMapper);
var objectMapper = (new ObjectMapper())
.configure(SerializationFeature.INDENT_OUTPUT, false)
.setSerializationInclusion(JsonInclude.Include.ALWAYS);
return new JacksonJsonpMapper(objectMapper);
}
/**
@@ -15,15 +15,9 @@
*/
package org.springframework.data.elasticsearch.client.elc.aot;
import co.elastic.clients.elasticsearch._types.mapping.RuntimeFieldType;
import co.elastic.clients.elasticsearch._types.mapping.TypeMapping;
import co.elastic.clients.elasticsearch.indices.IndexSettings;
import co.elastic.clients.elasticsearch.indices.PutMappingRequest;
import org.jspecify.annotations.Nullable;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
import org.springframework.util.ClassUtils;
/**
@@ -38,10 +32,14 @@ public class ElasticsearchClientRuntimeHints implements RuntimeHintsRegistrar {
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
hints.reflection()
.registerType(TypeReference.of(IndexSettings.class), builder -> builder.withField("_DESERIALIZER"))
.registerType(TypeReference.of(PutMappingRequest.class), builder -> builder.withField("_DESERIALIZER"))
.registerType(TypeReference.of(RuntimeFieldType.class), builder -> builder.withField("_DESERIALIZER"))
.registerType(TypeReference.of(TypeMapping.class), builder -> builder.withField("_DESERIALIZER"));
.registerTypeIfPresent(classLoader, "co.elastic.clients.elasticsearch.indices.IndexSettings",
builder -> builder.withField("_DESERIALIZER"))
.registerTypeIfPresent(classLoader, "co.elastic.clients.elasticsearch.indices.PutMappingRequest",
builder -> builder.withField("_DESERIALIZER"))
.registerTypeIfPresent(classLoader, "co.elastic.clients.elasticsearch._types.mapping.RuntimeFieldType",
builder -> builder.withField("_DESERIALIZER"))
.registerTypeIfPresent(classLoader, "co.elastic.clients.elasticsearch._types.mapping.TypeMapping",
builder -> builder.withField("_DESERIALIZER"));
if (ClassUtils.isPresent("org.apache.http.impl.auth.BasicScheme",
ElasticsearchClientRuntimeHints.class.getClassLoader())) {
@@ -245,7 +245,10 @@ abstract public class AbstractReactiveElasticsearchTemplate
public void onNext(List<T> entityList) {
onNextHasBeenCalled.set(true);
saveAll(entityList, index)
.map(sink::tryEmitNext)
.map(entity -> {
sink.tryEmitNext(entity);
return entity;
})
.doOnComplete(() -> {
if (!upstreamComplete.get()) {
if (subscription == null) {
@@ -255,7 +258,14 @@ abstract public class AbstractReactiveElasticsearchTemplate
} else {
sink.tryEmitComplete();
}
}).subscribe();
})
.subscribe(v -> {
}, error -> {
if (subscription != null) {
subscription.cancel();
}
sink.tryEmitError(error);
});
}
@Override
@@ -15,8 +15,7 @@
*/
package org.springframework.data.elasticsearch.core.document;
import tools.jackson.core.JacksonException;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Function;
@@ -88,7 +87,7 @@ public interface Document extends StringObjectMap<Document> {
clear();
try {
putAll(MapDocument.OBJECT_MAPPER.readerFor(Map.class).readValue(json));
} catch (JacksonException e) {
} catch (IOException e) {
throw new ConversionException("Cannot parse JSON", e);
}
return this;
@@ -15,9 +15,6 @@
*/
package org.springframework.data.elasticsearch.core.document;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.ObjectMapper;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -28,6 +25,9 @@ import org.jspecify.annotations.Nullable;
import org.springframework.data.elasticsearch.support.DefaultStringObjectMap;
import org.springframework.data.mapping.MappingException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* {@link Document} implementation backed by a {@link LinkedHashMap}.
*
@@ -344,7 +344,7 @@ class MapDocument implements Document {
public String toJson() {
try {
return OBJECT_MAPPER.writeValueAsString(this);
} catch (JacksonException e) {
} catch (JsonProcessingException e) {
throw new MappingException("Cannot render document to JSON", e);
}
}
@@ -1,25 +1,26 @@
package org.springframework.data.elasticsearch.core.geo;
import tools.jackson.core.JacksonException;
import tools.jackson.core.JsonGenerator;
import tools.jackson.core.JsonParser;
import tools.jackson.databind.DeserializationContext;
import tools.jackson.databind.SerializationContext;
import tools.jackson.databind.ValueDeserializer;
import tools.jackson.databind.ValueSerializer;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.springframework.data.geo.Point;
class PointSerializer extends ValueSerializer<Point> {
class PointSerializer extends JsonSerializer<Point> {
@Override
public void serialize(Point value, JsonGenerator gen, SerializationContext serializers) throws JacksonException {
gen.writePOJO(GeoPoint.fromPoint(value));
public void serialize(Point value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeObject(GeoPoint.fromPoint(value));
}
}
class PointDeserializer extends ValueDeserializer<Point> {
class PointDeserializer extends JsonDeserializer<Point> {
@Override
public Point deserialize(JsonParser p, DeserializationContext context) throws JacksonException {
public Point deserialize(JsonParser p, DeserializationContext context) throws IOException {
return GeoPoint.toPoint(p.readValueAs(GeoPoint.class));
}
}
@@ -15,14 +15,14 @@
*/
package org.springframework.data.elasticsearch.core.index;
import tools.jackson.databind.node.ObjectNode;
import java.io.IOException;
import org.jspecify.annotations.Nullable;
import org.springframework.data.elasticsearch.annotations.GeoShapeField;
import org.springframework.util.Assert;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* @author Peter-Josef Meisch
*/
@@ -18,13 +18,6 @@ package org.springframework.data.elasticsearch.core.index;
import static org.springframework.data.elasticsearch.core.index.MappingParameters.*;
import static org.springframework.util.StringUtils.*;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.node.ArrayNode;
import tools.jackson.databind.node.ObjectNode;
import tools.jackson.databind.node.StringNode;
import tools.jackson.databind.util.RawValue;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.nio.charset.Charset;
@@ -55,6 +48,13 @@ import org.springframework.data.mapping.PropertyHandler;
import org.springframework.util.StreamUtils;
import org.springframework.util.StringUtils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.TextNode;
import com.fasterxml.jackson.databind.util.RawValue;
/**
* @author Rizwan Idrees
* @author Mohsin Husen
@@ -184,7 +184,7 @@ public class MappingBuilder {
if (!excludeFromSource.isEmpty()) {
ObjectNode sourceNode = objectNode.putObject(SOURCE);
ArrayNode excludes = sourceNode.putArray(SOURCE_EXCLUDES);
excludeFromSource.stream().map(StringNode::new).forEach(excludes::add);
excludeFromSource.stream().map(TextNode::new).forEach(excludes::add);
}
return objectMapper.writer().writeValueAsString(objectNode);
@@ -238,7 +238,7 @@ public class MappingBuilder {
if (mappingAnnotation.dynamicDateFormats().length > 0) {
objectNode.putArray(DYNAMIC_DATE_FORMATS).addAll(Arrays.stream(mappingAnnotation.dynamicDateFormats())
.map(StringNode::valueOf).collect(Collectors.toList()));
.map(TextNode::valueOf).collect(Collectors.toList()));
}
if (runtimeFields != null) {
@@ -546,7 +546,7 @@ public class MappingBuilder {
if (children.length > 1) {
relationsNode.putArray(parent)
.addAll(Arrays.stream(children).map(StringNode::valueOf).collect(Collectors.toList()));
.addAll(Arrays.stream(children).map(TextNode::valueOf).collect(Collectors.toList()));
} else if (children.length == 1) {
relationsNode.put(parent, children[0]);
}
@@ -15,9 +15,6 @@
*/
package org.springframework.data.elasticsearch.core.index;
import tools.jackson.databind.node.ObjectNode;
import tools.jackson.databind.node.StringNode;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
@@ -31,6 +28,9 @@ import org.springframework.data.elasticsearch.annotations.*;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.TextNode;
/**
* A class to hold the mapping parameters that might be set on
* {@link org.springframework.data.elasticsearch.annotations.Field } or
@@ -285,7 +285,7 @@ public final class MappingParameters {
if (copyTo != null && copyTo.length > 0) {
objectNode.putArray(FIELD_PARAM_COPY_TO)
.addAll(Arrays.stream(copyTo).map(StringNode::valueOf).collect(Collectors.toList()));
.addAll(Arrays.stream(copyTo).map(TextNode::valueOf).collect(Collectors.toList()));
}
if (ignoreAbove != null) {
@@ -90,8 +90,7 @@ public abstract class AbstractElasticsearchRepositoryQuery implements Repository
Query query = createQuery(parameters);
IndexCoordinates index = parameterAccessor
.getIndexCoordinates(elasticsearchOperations.getIndexCoordinatesFor(clazz));
IndexCoordinates index = elasticsearchOperations.getIndexCoordinatesFor(clazz);
Object result = null;
@@ -110,7 +110,7 @@ abstract class AbstractReactiveElasticsearchRepositoryQuery implements Repositor
evaluationContextProvider);
String indexName = queryMethod.getEntityInformation().getIndexName();
IndexCoordinates index = parameterAccessor.getIndexCoordinates(IndexCoordinates.of(indexName));
IndexCoordinates index = IndexCoordinates.of(indexName);
ReactiveElasticsearchQueryExecution execution = getExecution(parameterAccessor,
new ResultProcessingConverter(processor));
@@ -17,7 +17,6 @@ package org.springframework.data.elasticsearch.repository.query;
import org.springframework.core.MethodParameter;
import org.springframework.data.core.TypeInformation;
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
import org.springframework.data.elasticsearch.core.query.RuntimeField;
import org.springframework.data.elasticsearch.core.query.ScriptedField;
import org.springframework.data.repository.query.Parameter;
@@ -43,8 +42,7 @@ public class ElasticsearchParameter extends Parameter {
@Override
public boolean isSpecialParameter() {
return super.isSpecialParameter() || isScriptedFieldParameter() || isRuntimeFieldParameter()
|| isIndexCoordinatesParameter();
return super.isSpecialParameter() || isScriptedFieldParameter() || isRuntimeFieldParameter();
}
public Boolean isScriptedFieldParameter() {
@@ -54,8 +52,4 @@ public class ElasticsearchParameter extends Parameter {
public Boolean isRuntimeFieldParameter() {
return RuntimeField.class.isAssignableFrom(getType());
}
public Boolean isIndexCoordinatesParameter() {
return IndexCoordinates.class.isAssignableFrom(getType());
}
}
@@ -15,7 +15,6 @@
*/
package org.springframework.data.elasticsearch.repository.query;
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
import org.springframework.data.repository.query.ParameterAccessor;
/**
@@ -30,11 +29,4 @@ public interface ElasticsearchParameterAccessor extends ParameterAccessor {
* @return
*/
Object[] getValues();
/**
* If there is a parameter of type IndexCoordinates, this parameter value is returned, otherwise the defaults value
*
* @param defaults default value
*/
IndexCoordinates getIndexCoordinates(IndexCoordinates defaults);
}
@@ -29,11 +29,10 @@ import org.springframework.data.repository.query.ParametersSource;
* @since 3.2
*/
public class ElasticsearchParameters extends Parameters<ElasticsearchParameters, ElasticsearchParameter> {
private final List<ElasticsearchParameter> scriptedFields = new ArrayList<>();
private final List<ElasticsearchParameter> runtimeFields = new ArrayList<>();
private final int indexCoordinatesIndex;
public ElasticsearchParameters(ParametersSource parametersSource) {
super(parametersSource,
@@ -54,23 +53,6 @@ public class ElasticsearchParameters extends Parameters<ElasticsearchParameters,
runtimeFields.add(parameter);
}
}
this.indexCoordinatesIndex = initIndexCoordinatesIndex();
}
private int initIndexCoordinatesIndex() {
int indexCoordinatesIndex = -1;
int index = 0;
for (ElasticsearchParameter parameter : this) {
if (parameter.isIndexCoordinatesParameter()) {
if (indexCoordinatesIndex != -1) {
throw new IllegalArgumentException(this + " can only contain at most one IndexCoordinates parameter.");
} else {
indexCoordinatesIndex = index;
}
}
index++;
}
return indexCoordinatesIndex;
}
private ElasticsearchParameter parameterFactory(MethodParameter methodParameter, TypeInformation<?> domainType) {
@@ -79,7 +61,6 @@ public class ElasticsearchParameters extends Parameters<ElasticsearchParameters,
private ElasticsearchParameters(List<ElasticsearchParameter> parameters) {
super(parameters);
this.indexCoordinatesIndex = initIndexCoordinatesIndex();
}
@Override
@@ -94,12 +75,4 @@ public class ElasticsearchParameters extends Parameters<ElasticsearchParameters,
List<ElasticsearchParameter> getRuntimeFields() {
return runtimeFields;
}
public boolean hasIndexCoordinatesParameter() {
return this.indexCoordinatesIndex != -1;
}
public int getIndexCoordinatesIndex() {
return indexCoordinatesIndex;
}
}
@@ -15,7 +15,6 @@
*/
package org.springframework.data.elasticsearch.repository.query;
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
import org.springframework.data.repository.query.ParametersParameterAccessor;
/**
@@ -26,7 +25,6 @@ public class ElasticsearchParametersParameterAccessor extends ParametersParamete
implements ElasticsearchParameterAccessor {
private final Object[] values;
private final ElasticsearchParameters eleasticSearchParameters;
/**
* Creates a new {@link ElasticsearchParametersParameterAccessor}.
@@ -38,19 +36,10 @@ public class ElasticsearchParametersParameterAccessor extends ParametersParamete
super(method.getParameters(), values);
this.values = values;
this.eleasticSearchParameters = method.getParameters();
}
@Override
public Object[] getValues() {
return values;
}
@Override
public IndexCoordinates getIndexCoordinates(IndexCoordinates defaults) {
if (!eleasticSearchParameters.hasIndexCoordinatesParameter()) {
return defaults;
}
return (IndexCoordinates) getValues()[eleasticSearchParameters.getIndexCoordinatesIndex()];
}
}
@@ -0,0 +1,39 @@
/*
* Copyright 2013-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.elasticsearch.repository.query;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.repository.query.ValueExpressionDelegate;
/**
* ElasticsearchPartQuery
*
* @author Rizwan Idrees
* @author Mohsin Husen
* @author Kevin Leturc
* @author Mark Paluch
* @author Rasmus Faber-Espensen
* @author Peter-Josef Meisch
* @author Haibo Liu
* @deprecated since 5.5, use {@link RepositoryPartQuery} instead
*/
@Deprecated(forRemoval = true)
public class ElasticsearchPartQuery extends RepositoryPartQuery {
public ElasticsearchPartQuery(ElasticsearchQueryMethod method, ElasticsearchOperations elasticsearchOperations,
ValueExpressionDelegate valueExpressionDelegate) {
super(method, elasticsearchOperations, valueExpressionDelegate);
}
}
@@ -373,11 +373,6 @@ public class ElasticsearchQueryMethod extends QueryMethod {
return fieldNames.toArray(new String[0]);
}
@Override
public ElasticsearchParameters getParameters() {
return (ElasticsearchParameters) super.getParameters();
}
// region Copied from QueryMethod base class
/*
* Copied from the QueryMethod class adding support for collections of SearchHit instances. No static method here.
@@ -0,0 +1,38 @@
/*
* Copyright 2013-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.elasticsearch.repository.query;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.repository.query.ValueExpressionDelegate;
/**
* ElasticsearchStringQuery
*
* @author Rizwan Idrees
* @author Mohsin Husen
* @author Mark Paluch
* @author Taylor Ono
* @author Peter-Josef Meisch
* @author Haibo Liu
* @deprecated since 5.5, use {@link RepositoryStringQuery}
*/
@Deprecated(since = "5.5", forRemoval = true)
public class ElasticsearchStringQuery extends RepositoryStringQuery {
public ElasticsearchStringQuery(ElasticsearchQueryMethod queryMethod, ElasticsearchOperations elasticsearchOperations,
String queryString, ValueExpressionDelegate valueExpressionDelegate) {
super(queryMethod, elasticsearchOperations, queryString, valueExpressionDelegate);
}
}
@@ -136,6 +136,11 @@ public class ReactiveElasticsearchQueryMethod extends ElasticsearchQueryMethod {
return true;
}
@Override
public ElasticsearchParameters getParameters() {
return (ElasticsearchParameters) super.getParameters();
}
@Override
protected boolean isAllowedGenericType(ParameterizedType methodGenericReturnType) {
return super.isAllowedGenericType(methodGenericReturnType)
@@ -0,0 +1,40 @@
/*
* Copyright 2019-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.elasticsearch.repository.query;
import org.springframework.data.elasticsearch.core.ReactiveElasticsearchOperations;
import org.springframework.data.repository.query.ValueExpressionDelegate;
/**
* @author Christoph Strobl
* @author Taylor Ono
* @author Haibo Liu
* @since 3.2
* @deprecated since 5.5, use {@link ReactiveRepositoryStringQuery}
*/
@Deprecated(since = "5.5", forRemoval = true)
public class ReactiveElasticsearchStringQuery extends ReactiveRepositoryStringQuery {
public ReactiveElasticsearchStringQuery(ReactiveElasticsearchQueryMethod queryMethod,
ReactiveElasticsearchOperations operations, ValueExpressionDelegate valueExpressionDelegate) {
super(queryMethod, operations, valueExpressionDelegate);
}
public ReactiveElasticsearchStringQuery(String query, ReactiveElasticsearchQueryMethod queryMethod,
ReactiveElasticsearchOperations operations, ValueExpressionDelegate valueExpressionDelegate) {
super(query, queryMethod, operations, valueExpressionDelegate);
}
}
@@ -15,9 +15,7 @@
*/
package org.springframework.data.elasticsearch.support;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -27,6 +25,9 @@ import java.util.function.BiConsumer;
import org.jspecify.annotations.Nullable;
import org.springframework.util.Assert;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* @author Peter-Josef Meisch
*/
@@ -47,7 +48,7 @@ public class DefaultStringObjectMap<T extends StringObjectMap<T>> implements Str
public String toJson() {
try {
return OBJECT_MAPPER.writeValueAsString(this);
} catch (JacksonException e) {
} catch (JsonProcessingException e) {
throw new IllegalArgumentException("Cannot render document to JSON", e);
}
}
@@ -60,7 +61,7 @@ public class DefaultStringObjectMap<T extends StringObjectMap<T>> implements Str
delegate.clear();
try {
delegate.putAll(OBJECT_MAPPER.readerFor(Map.class).readValue(json));
} catch (JacksonException e) {
} catch (IOException e) {
throw new IllegalArgumentException("Cannot parse JSON", e);
}
return (T) this;
+5 -1
View File
@@ -1,4 +1,4 @@
Spring Data Elasticsearch 6.1 M1 (2026.0.0)
Spring Data Elasticsearch 6.0.6 (2025.1.6)
Copyright (c) [2013-2022] Pivotal Software, Inc.
This product is licensed to you under the Apache License, Version 2.0 (the "License").
@@ -17,3 +17,7 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
@@ -1220,6 +1220,28 @@ public abstract class ReactiveElasticsearchIntegrationTests {
.allMatch(failureStatus -> failureStatus.status().equals(409));
}
@Test // Error propagation in reactive Flux save
@DisplayName("should propagate errors during Flux save operations")
void shouldPropagateErrorsDuringFluxSaveOperations() {
// Create a Flux that will produce an error after emitting some valid entities
Flux<SampleEntity> entitiesWithError = Flux.concat(
Flux.just(
randomEntity("valid entity 1"),
randomEntity("valid entity 2")),
Flux.error(new RuntimeException("Simulated error during entity creation")));
// The save operation should propagate the error to the subscriber.
// With the manual subscriber approach, the error propagates eagerly —
// sink.tryEmitError is called before in-flight saveAll results can be emitted,
// so the caller sees 0 entities before the error.
operations.save(entitiesWithError, SampleEntity.class, 10)
.as(StepVerifier::create)
.expectNextCount(0)
.expectErrorMatches(throwable -> throwable instanceof RuntimeException &&
throwable.getMessage().equals("Simulated error during entity creation"))
.verify();
}
// endregion
// region Helper functions
@@ -1,23 +0,0 @@
package org.springframework.data.elasticsearch.repository.query.indexcoordinates;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchTemplateConfiguration;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
import org.springframework.data.elasticsearch.utils.IndexNameProvider;
import org.springframework.test.context.ContextConfiguration;
@ContextConfiguration(classes = { IndexCoordinatesParameterELCIntegrationTests.Config.class })
public class IndexCoordinatesParameterELCIntegrationTests extends IndexCoordinatesParameterIntegrationTests {
@Configuration
@Import({ ElasticsearchTemplateConfiguration.class })
@EnableElasticsearchRepositories(considerNestedRepositories = true)
static class Config {
@Bean
IndexNameProvider indexNameProvider() {
return new IndexNameProvider("query-index-coordinates");
}
}
}
@@ -1,98 +0,0 @@
package org.springframework.data.elasticsearch.repository.query.indexcoordinates;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.data.elasticsearch.utils.IndexNameProvider;
@SpringIntegrationTest
abstract class IndexCoordinatesParameterIntegrationTests {
@Autowired ElasticsearchOperations operations;
@Autowired IndexNameProvider indexNameProvider;
@Autowired RecordRepository recordRepository;
@BeforeEach
public void before() {
indexNameProvider.increment();
}
@Test
@Order(Integer.MAX_VALUE)
void cleanup() {
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + "*")).delete();
}
@Test // #2506
@DisplayName("should use indexcoordinates passes as repository query argument")
void shouldUseIndexCoordinatesPassesAsRepositoryQueryArgument() {
var record1 = new Record("1", "one");
var indexName1 = indexNameProvider.indexName();
var indexCoordinates1 = IndexCoordinates.of(indexName1);
operations.save(record1, indexCoordinates1);
var record2 = new Record("2", "two");
var indexName2 = indexName1 + "second";
var indexCoordinates2 = IndexCoordinates.of(indexName2);
operations.save(record2, indexCoordinates2);
// search for record1
var searchHits = recordRepository.findByText("one");
assert searchHits.getTotalHits() == 1;
searchHits = recordRepository.findByText("one", indexCoordinates2);
assert searchHits.getTotalHits() == 0;
// search for record2
searchHits = recordRepository.findByText("two");
assert searchHits.getTotalHits() == 0;
searchHits = recordRepository.findByText("two", indexCoordinates2);
assert searchHits.getTotalHits() == 1;
}
@Document(indexName = "#{@indexNameProvider.indexName()}")
static class Record {
@Nullable
@Id private String id;
@Nullable
@Field(type = FieldType.Keyword) private String text;
public Record(@Nullable String id, @Nullable String text) {
this.id = id;
this.text = text;
}
public @Nullable String getId() {
return id;
}
public void setId(@Nullable String id) {
this.id = id;
}
public @Nullable String getText() {
return text;
}
public void setText(@Nullable String text) {
this.text = text;
}
}
interface RecordRepository extends ElasticsearchRepository<Record, String> {
SearchHits<Record> findByText(String text);
SearchHits<Record> findByText(String text, IndexCoordinates index);
}
}
@@ -1,24 +0,0 @@
package org.springframework.data.elasticsearch.repository.query.indexcoordinates;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.elasticsearch.junit.jupiter.ReactiveElasticsearchTemplateConfiguration;
import org.springframework.data.elasticsearch.repository.config.EnableReactiveElasticsearchRepositories;
import org.springframework.data.elasticsearch.utils.IndexNameProvider;
import org.springframework.test.context.ContextConfiguration;
@ContextConfiguration(classes = { ReactiveIndexCoordinatesParameterELCIntegrationTests.Config.class })
public class ReactiveIndexCoordinatesParameterELCIntegrationTests
extends ReactiveIndexCoordinatesParameterIntegrationTests {
@Configuration
@Import({ ReactiveElasticsearchTemplateConfiguration.class })
@EnableReactiveElasticsearchRepositories(considerNestedRepositories = true)
static class Config {
@Bean
IndexNameProvider indexNameProvider() {
return new IndexNameProvider("reactive-query-index-coordinates");
}
}
}
@@ -1,109 +0,0 @@
package org.springframework.data.elasticsearch.repository.query.indexcoordinates;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.core.ReactiveElasticsearchOperations;
import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest;
import org.springframework.data.elasticsearch.repository.ReactiveElasticsearchRepository;
import org.springframework.data.elasticsearch.utils.IndexNameProvider;
@SpringIntegrationTest
abstract class ReactiveIndexCoordinatesParameterIntegrationTests {
@Autowired ReactiveElasticsearchOperations operations;
@Autowired IndexNameProvider indexNameProvider;
@Autowired RecordRepository recordRepository;
@BeforeEach
public void before() {
indexNameProvider.increment();
}
@Test
@Order(Integer.MAX_VALUE)
void cleanup() {
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + "*")).delete().block();
}
@Test // #2506
@DisplayName("should use indexcoordinates passes as repository query argument")
void shouldUseIndexCoordinatesPassesAsRepositoryQueryArgument() {
var record1 = new Record("1", "one");
var indexName1 = indexNameProvider.indexName();
var indexCoordinates1 = IndexCoordinates.of(indexName1);
operations.save(record1, indexCoordinates1).block();
var record2 = new Record("2", "two");
var indexName2 = indexName1 + "second";
var indexCoordinates2 = IndexCoordinates.of(indexName2);
operations.save(record2, indexCoordinates2).block();
// search for record1
recordRepository.findByText("one")
.as(StepVerifier::create)
.expectNextCount(1)
.verifyComplete();
recordRepository.findByText("one", indexCoordinates2)
.as(StepVerifier::create)
.expectNextCount(0)
.verifyComplete();
// search for record2
recordRepository.findByText("two")
.as(StepVerifier::create)
.expectNextCount(0)
.verifyComplete();
recordRepository.findByText("two", indexCoordinates2)
.as(StepVerifier::create)
.expectNextCount(1)
.verifyComplete();
}
@Document(indexName = "#{@indexNameProvider.indexName()}")
static class Record {
@Nullable
@Id private String id;
@Nullable
@Field(type = FieldType.Keyword) private String text;
public Record(@Nullable String id, @Nullable String text) {
this.id = id;
this.text = text;
}
public @Nullable String getId() {
return id;
}
public void setId(@Nullable String id) {
this.id = id;
}
public @Nullable String getText() {
return text;
}
public void setText(@Nullable String text) {
this.text = text;
}
}
interface RecordRepository extends ReactiveElasticsearchRepository<Record, String> {
Flux<SearchHit<Record>> findByText(String text);
Flux<SearchHit<Record>> findByText(String text, IndexCoordinates index);
}
}
@@ -15,7 +15,7 @@
#
#
sde.testcontainers.image-name=docker.elastic.co/elasticsearch/elasticsearch
sde.testcontainers.image-version=9.2.5
sde.testcontainers.image-version=9.2.8
#
#
# needed as we do a DELETE /* at the end of the tests, will be required from 8.0 on, produces a warning since 7.13