1
0
mirror of synced 2026-05-23 20:53:17 +00:00

Compare commits

..

41 Commits

Author SHA1 Message Date
Jens Schauder bd62128b52 Release version 5.2.9 (2023.1.9).
See #2938
2024-08-16 08:58:34 +02:00
Jens Schauder 16eb208d77 Prepare 5.2.9 (2023.1.9).
See #2938
2024-08-16 08:58:12 +02:00
Mark Paluch 0575323975 Update CI properties.
See #2938
2024-08-08 10:17:45 +02:00
Mark Paluch 4289f73b24 Upgrade to Maven Wrapper 3.9.8.
See #2957
2024-08-08 10:17:24 +02:00
Eric Haag 7f246724d2 Migrate build to Spring Develocity Conventions extension.
* Migrate build to Spring Develocity Conventions extension.

* Adopt Develocity environment variables.

Closes #2944
2024-08-01 14:54:29 +02:00
Mark Paluch ce6b4d853f Bundle Javadoc with Antora documentation site.
Closes #2948.
2024-07-31 14:53:30 +02:00
Jens Schauder c87d106074 After release cleanups.
See #2931
2024-07-12 13:36:35 +02:00
Jens Schauder bf21b697ca Prepare next development iteration.
See #2931
2024-07-12 13:36:34 +02:00
Jens Schauder eead581ff0 Release version 5.2.8 (2023.1.8).
See #2931
2024-07-12 13:33:06 +02:00
Jens Schauder aef71db320 Prepare 5.2.8 (2023.1.8).
See #2931
2024-07-12 13:32:46 +02:00
Mark Paluch 452c76fb12 Switch to Broadcom docker proxy.
Closes #2934
2024-06-20 11:21:14 +02:00
Mark Paluch c9a47997b9 After release cleanups.
See #2912
2024-06-14 10:06:43 +02:00
Mark Paluch 4a42c673ce Prepare next development iteration.
See #2912
2024-06-14 10:06:42 +02:00
Mark Paluch 4729b9cfdc Release version 5.2.7 (2023.1.7).
See #2912
2024-06-14 10:04:22 +02:00
Mark Paluch aa16c0c5ab Prepare 5.2.7 (2023.1.7).
See #2912
2024-06-14 10:04:05 +02:00
Peter-Josef Meisch 5e507fa163 Fix max dim value for dense vector.
Closes #2911

(cherry picked from commit e997b39f68)
(cherry picked from commit ba9edf8ec8)
2024-05-18 18:27:59 +02:00
Mark Paluch a355537d78 After release cleanups.
See #2895
2024-05-17 11:24:38 +02:00
Mark Paluch 4fbf9f8b5a Prepare next development iteration.
See #2895
2024-05-17 11:24:37 +02:00
Mark Paluch 2cb27c26d7 Release version 5.2.6 (2023.1.6).
See #2895
2024-05-17 11:22:24 +02:00
Mark Paluch c322797eab Prepare 5.2.6 (2023.1.6).
See #2895
2024-05-17 11:22:00 +02:00
Peter-Josef Meisch c81958f62d Fix implementation of explicit refresh policy.
Original Pull Request #2908
Closes #2907

(cherry picked from commit 94a40a7a75)
2024-05-10 09:35:20 +02:00
Peter-Josef Meisch ed18be6f1c Fix parameter in Order constructor.
Closes #2897

(cherry picked from commit ad66510e9e)
2024-04-15 21:11:35 +02:00
Mark Paluch b3a21fbb7c After release cleanups.
See #2873
2024-04-12 10:17:29 +02:00
Mark Paluch d874b9d000 Prepare next development iteration.
See #2873
2024-04-12 10:17:28 +02:00
Mark Paluch 36e6a4b328 Release version 5.2.5 (2023.1.5).
See #2873
2024-04-12 10:15:11 +02:00
Mark Paluch 3710e47abd Prepare 5.2.5 (2023.1.5).
See #2873
2024-04-12 10:14:56 +02:00
Mark Paluch c40abc267b After release cleanups.
See #2850
2024-03-15 10:20:09 +01:00
Mark Paluch b479184d83 Prepare next development iteration.
See #2850
2024-03-15 10:20:08 +01:00
Mark Paluch f2370bc7df Release version 5.2.4 (2023.1.4).
See #2850
2024-03-15 10:17:49 +01:00
Mark Paluch 5f045d104e Prepare 5.2.4 (2023.1.4).
See #2850
2024-03-15 10:17:30 +01:00
Peter-Josef Meisch b52e8d1431 Fix setting setting id in bulkrequest.
Original Pull Request #2862
Closes #2861

(cherry picked from commit debf04b499)
2024-02-28 21:45:49 +01:00
Mark Paluch e86bb771be After release cleanups.
See #2825
2024-02-16 13:53:53 +01:00
Mark Paluch c9fbc17109 Prepare next development iteration.
See #2825
2024-02-16 13:53:51 +01:00
Mark Paluch 397e155d5e Release version 5.2.3 (2023.1.3).
See #2825
2024-02-16 13:50:30 +01:00
Mark Paluch 4e52594d12 Prepare 5.2.3 (2023.1.3).
See #2825
2024-02-16 13:50:02 +01:00
Peter-Josef Meisch 310f0ed567 Fix criteria filter in native query.
Original Pull Request #2846
Closes #2840

(cherry picked from commit e9ecebd9ef)
2024-02-06 21:23:50 +01:00
Peter-Josef Meisch dab0be04db Fix store null values implementation.
Original Pull Request #2842

(cherry picked from commit 0a1e20579e)
2024-01-31 17:32:41 +01:00
Mark Paluch e8f269d9ec Refine Artifactory build name.
See #2772
2024-01-31 15:13:58 +01:00
Peter-Josef Meisch 1e9824ae2d Upgrade to Elasticsearch 8.11.4.
Original Pull Request #2829
Closes #2827
2024-01-19 07:18:40 +01:00
Mark Paluch c9b8b3f33d After release cleanups.
See #2804
2024-01-12 10:54:33 +01:00
Mark Paluch a806553169 Prepare next development iteration.
See #2804
2024-01-12 10:54:32 +01:00
29 changed files with 327 additions and 157 deletions
+1 -2
View File
@@ -30,7 +30,6 @@ target
build/
node_modules
node
package.json
package-lock.json
.mvn/.gradle-enterprise
.mvn/.develocity
+3 -8
View File
@@ -1,13 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
<groupId>com.gradle</groupId>
<artifactId>gradle-enterprise-maven-extension</artifactId>
<version>1.19.2</version>
</extension>
<extension>
<groupId>com.gradle</groupId>
<artifactId>common-custom-user-data-maven-extension</artifactId>
<version>1.12.4</version>
<groupId>io.spring.develocity.conventions</groupId>
<artifactId>develocity-conventions-maven-extension</artifactId>
<version>0.0.19</version>
</extension>
</extensions>
-31
View File
@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<gradleEnterprise
xmlns="https://www.gradle.com/gradle-enterprise-maven" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.gradle.com/gradle-enterprise-maven https://www.gradle.com/schema/gradle-enterprise-maven.xsd">
<server>
<url>https://ge.spring.io</url>
</server>
<buildScan>
<backgroundBuildScanUpload>false</backgroundBuildScanUpload>
<captureGoalInputFiles>true</captureGoalInputFiles>
<publishIfAuthenticated>true</publishIfAuthenticated>
<obfuscation>
<ipAddresses>#{{'0.0.0.0'}}</ipAddresses>
</obfuscation>
</buildScan>
<buildCache>
<local>
<enabled>true</enabled>
</local>
<remote>
<server>
<credentials>
<username>${env.GRADLE_ENTERPRISE_CACHE_USERNAME}</username>
<password>${env.GRADLE_ENTERPRISE_CACHE_PASSWORD}</password>
</credentials>
</server>
<enabled>true</enabled>
<storeEnabled>#{env['GRADLE_ENTERPRISE_CACHE_USERNAME'] != null and env['GRADLE_ENTERPRISE_CACHE_PASSWORD'] != null}</storeEnabled>
</remote>
</buildCache>
</gradleEnterprise>
+2 -2
View File
@@ -1,3 +1,3 @@
#Thu Dec 14 08:34:15 CET 2023
#Thu Aug 08 10:17:24 CEST 2024
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.6/apache-maven-3.9.6-bin.zip
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.8/apache-maven-3.9.8-bin.zip
Vendored
+22 -22
View File
@@ -33,15 +33,16 @@ pipeline {
environment {
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}")
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
}
steps {
script {
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"
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"
}
}
}
}
@@ -63,14 +64,15 @@ pipeline {
options { timeout(time: 30, unit: 'MINUTES') }
environment {
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}")
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
}
steps {
script {
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"
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"
}
}
}
}
@@ -92,24 +94,22 @@ pipeline {
options { timeout(time: 20, unit: 'MINUTES') }
environment {
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}")
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
}
steps {
script {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
"DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} " +
"DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} " +
"GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} " +
"./mvnw -s settings.xml -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch-non-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=${BUILD_NUMBER} " +
"-Dmaven.test.skip=true clean deploy -U -B"
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
"./mvnw -s settings.xml -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch-non-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.test.skip=true clean deploy -U -B"
}
}
}
}
-5
View File
@@ -2,12 +2,7 @@
set -euo pipefail
export DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR}
export DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW}
export JENKINS_USER=${JENKINS_USER_NAME}
# The environment variable to configure access key is still GRADLE_ENTERPRISE_ACCESS_KEY
export GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY}
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
+6 -5
View File
@@ -1,10 +1,10 @@
# Java versions
java.main.tag=17.0.9_9-jdk-focal
java.next.tag=21.0.1_12-jdk-jammy
java.main.tag=17.0.12_7-jdk-focal
java.next.tag=22.0.2_9-jdk-jammy
# Docker container images - standard
docker.java.main.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.main.tag}
docker.java.next.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.next.tag}
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.4.4.version=4.4.25
@@ -25,9 +25,10 @@ docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -
# 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.cache.credentials=gradle_enterprise_cache_user
develocity.access-key=gradle_enterprise_secret_access_key
jenkins.user.name=spring-builds+jenkins
-6
View File
@@ -4,14 +4,8 @@ set -euo pipefail
mkdir -p /tmp/jenkins-home/.m2/spring-data-elasticsearch
chown -R 1001:1001 .
export DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR}
export DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW}
export JENKINS_USER=${JENKINS_USER_NAME}
# The environment variable to configure access key is still GRADLE_ENTERPRISE_ACCESS_KEY
export GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY}
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
+10
View File
@@ -0,0 +1,10 @@
{
"dependencies": {
"antora": "3.2.0-alpha.6",
"@antora/atlas-extension": "1.0.0-alpha.2",
"@antora/collector-extension": "1.0.0-alpha.7",
"@asciidoctor/tabs": "1.0.0-beta.6",
"@springio/antora-extensions": "1.13.0",
"@springio/asciidoctor-extensions": "1.0.0-alpha.11"
}
}
+5 -5
View File
@@ -5,12 +5,12 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>5.2.2</version>
<version>5.2.9</version>
<parent>
<groupId>org.springframework.data.build</groupId>
<artifactId>spring-data-parent</artifactId>
<version>3.2.2</version>
<version>3.2.9</version>
</parent>
<name>Spring Data Elasticsearch</name>
@@ -18,10 +18,10 @@
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>
<properties>
<springdata.commons>3.2.2</springdata.commons>
<springdata.commons>3.2.9</springdata.commons>
<!-- version of the ElasticsearchClient -->
<elasticsearch-java>8.11.3</elasticsearch-java>
<elasticsearch-java>8.11.4</elasticsearch-java>
<blockhound-junit>1.0.8.RELEASE</blockhound-junit>
<hoverfly>0.14.4</hoverfly>
@@ -472,7 +472,7 @@
<build>
<plugins>
<plugin>
<groupId>io.spring.maven.antora</groupId>
<groupId>org.antora</groupId>
<artifactId>antora-maven-plugin</artifactId>
</plugin>
</plugins>
+3 -5
View File
@@ -3,8 +3,7 @@
# The purpose of this Antora playbook is to build the docs in the current branch.
antora:
extensions:
- '@antora/collector-extension'
- require: '@springio/antora-extensions/root-component-extension'
- require: '@springio/antora-extensions'
root_component_name: 'data-elasticsearch'
site:
title: Spring Data Elasticsearch
@@ -22,13 +21,12 @@ content:
start_path: src/main/antora
asciidoc:
attributes:
page-pagination: ''
hide-uri-scheme: '@'
tabs-sync-option: '@'
chomp: 'all'
extensions:
- '@asciidoctor/tabs'
- '@springio/asciidoctor-extensions'
- '@springio/asciidoctor-extensions/javadoc-extension'
sourcemap: true
urls:
latest_version_segment: ''
@@ -38,5 +36,5 @@ runtime:
format: pretty
ui:
bundle:
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.5/ui-bundle.zip
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.16/ui-bundle.zip
snapshot: true
+5
View File
@@ -10,3 +10,8 @@ ext:
local: true
scan:
dir: target/classes/
- run:
command: ./mvnw package -Pdistribute
local: true
scan:
dir: target/antora
+2 -1
View File
@@ -39,4 +39,5 @@
** xref:repositories/query-keywords-reference.adoc[]
** xref:repositories/query-return-types-reference.adoc[]
* https://github.com/spring-projects/spring-data-commons/wiki[Wiki]
* xref:attachment$api/java/index.html[Javadoc,role=link-external,window=_blank]
* https://github.com/spring-projects/spring-data-commons/wiki[Wiki,role=link-external,window=_blank]
@@ -31,7 +31,7 @@ public class MyClientConfig extends ElasticsearchConfiguration {
<.> for a detailed description of the builder methods see xref:elasticsearch/clients.adoc#elasticsearch.clients.configuration[Client Configuration]
====
The `ElasticsearchConfiguration` class allows further configuration by overriding for example the `jsonpMapper()` or `transportOptions()` methods.
The javadoc:org.springframework.data.elasticsearch.client.elc.ElasticsearchConfiguration[]] class allows further configuration by overriding for example the `jsonpMapper()` or `transportOptions()` methods.
The following beans can then be injected in other Spring components:
@@ -52,13 +52,13 @@ RestClient restClient; <.>
JsonpMapper jsonpMapper; <.>
----
<.> an implementation of `ElasticsearchOperations`
<.> an implementation of javadoc:org.springframework.data.elasticsearch.core.ElasticsearchOperations[]
<.> the `co.elastic.clients.elasticsearch.ElasticsearchClient` that is used.
<.> the low level `RestClient` from the Elasticsearch libraries
<.> the `JsonpMapper` user by the Elasticsearch `Transport`
====
Basically one should just use the `ElasticsearchOperations` to interact with the Elasticsearch cluster.
Basically one should just use the javadoc:org.springframework.data.elasticsearch.core.ElasticsearchOperations[] to interact with the Elasticsearch cluster.
When using repositories, this instance is used under the hood as well.
[[elasticsearch.clients.reactiverestclient]]
@@ -86,7 +86,7 @@ public class MyClientConfig extends ReactiveElasticsearchConfiguration {
<.> for a detailed description of the builder methods see xref:elasticsearch/clients.adoc#elasticsearch.clients.configuration[Client Configuration]
====
The `ReactiveElasticsearchConfiguration` class allows further configuration by overriding for example the `jsonpMapper()` or `transportOptions()` methods.
The javadoc:org.springframework.data.elasticsearch.client.elc.ReactiveElasticsearchConfiguration[] class allows further configuration by overriding for example the `jsonpMapper()` or `transportOptions()` methods.
The following beans can then be injected in other Spring components:
@@ -108,20 +108,20 @@ JsonpMapper jsonpMapper; <.>
the following can be injected:
<.> an implementation of `ReactiveElasticsearchOperations`
<.> an implementation of javadoc:org.springframework.data.elasticsearch.core.ReactiveElasticsearchOperations[]
<.> the `org.springframework.data.elasticsearch.client.elc.ReactiveElasticsearchClient` that is used.
This is a reactive implementation based on the Elasticsearch client implementation.
<.> the low level `RestClient` from the Elasticsearch libraries
<.> the `JsonpMapper` user by the Elasticsearch `Transport`
====
Basically one should just use the `ReactiveElasticsearchOperations` to interact with the Elasticsearch cluster.
Basically one should just use the javadoc:org.springframework.data.elasticsearch.core.ReactiveElasticsearchOperations[] to interact with the Elasticsearch cluster.
When using repositories, this instance is used under the hood as well.
[[elasticsearch.clients.configuration]]
== Client Configuration
Client behaviour can be changed via the `ClientConfiguration` that allows to set options for SSL, connect and socket timeouts, headers and other parameters.
Client behaviour can be changed via the javadoc:org.springframework.data.elasticsearch.client.ClientConfiguration[] that allows to set options for SSL, connect and socket timeouts, headers and other parameters.
.Client Configuration
====
@@ -178,7 +178,7 @@ If this is used in the reactive setup, the supplier function *must not* block!
[[elasticsearch.clients.configuration.callbacks]]
=== Client configuration callbacks
The `ClientConfiguration` class offers the most common parameters to configure the client.
The javadoc:org.springframework.data.elasticsearch.client.ClientConfiguration[] class offers the most common parameters to configure the client.
In the case this is not enough, the user can add callback functions by using the `withClientConfigurer(ClientConfigurationCallback<?>)` method.
The following callbacks are provided:
@@ -1,6 +1,10 @@
[[new-features]]
= What's new
[[new-features.5-2-3]]
== New in Spring Data Elasticsearch 5.2.2
* Upgrade to Elasticsearch 8.11.4
[[new-features.5-2-2]]
== New in Spring Data Elasticsearch 5.2.2
* Upgrade to Elasticsearch 8.11.3
@@ -3,10 +3,10 @@
Spring Data Elasticsearch uses several interfaces to define the operations that can be called against an Elasticsearch index (for a description of the reactive interfaces see xref:elasticsearch/reactive-template.adoc[]).
* `IndexOperations` defines actions on index level like creating or deleting an index.
* `DocumentOperations` defines actions to store, update and retrieve entities based on their id.
* `SearchOperations` define the actions to search for multiple entities using queries
* `ElasticsearchOperations` combines the `DocumentOperations` and `SearchOperations` interfaces.
* javadoc:org.springframework.data.elasticsearch.core.IndexOperations[] defines actions on index level like creating or deleting an index.
* javadoc:org.springframework.data.elasticsearch.core.DocumentOperations[] defines actions to store, update and retrieve entities based on their id.
* javadoc:org.springframework.data.elasticsearch.core.SearchOperations[] define the actions to search for multiple entities using queries
* javadoc:org.springframework.data.elasticsearch.core.ElasticsearchOperations[] combines the `DocumentOperations` and `SearchOperations` interfaces.
These interfaces correspond to the structuring of the https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html[Elasticsearch API].
@@ -6,7 +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
| 2023.1 (Vaughan) | 5.2.x | 8.11.3 | 6.1.x
| 2023.1 (Vaughan) | 5.2.x | 8.11.4 | 6.1.x
| 2023.0 (Ullmann) | 5.1.x | 8.7.1 | 6.0.x
| 2022.0 (Turing) | 5.0.xfootnote:oom[Out of maintenance] | 8.5.3 | 6.0.x
| 2021.2 (Raj) | 4.4.xfootnote:oom[] | 7.17.3 | 5.3.x
@@ -31,6 +31,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
@@ -118,7 +122,13 @@ public abstract class ElasticsearchConfiguration extends ElasticsearchConfigurat
*/
@Bean
public JsonpMapper jsonpMapper() {
return new JacksonJsonpMapper();
// 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.
var objectMapper = (new ObjectMapper())
.configure(SerializationFeature.INDENT_OUTPUT, false)
.setSerializationInclusion(JsonInclude.Include.ALWAYS);
return new JacksonJsonpMapper(objectMapper);
}
/**
@@ -545,13 +545,12 @@ class RequestConverter {
Object queryObject = query.getObject();
if (queryObject != null) {
String id = StringUtils.hasText(query.getId()) ? query.getId() : getPersistentEntityId(queryObject);
builder //
.id(id) //
builder
.id(StringUtils.hasText(query.getId()) ? query.getId() : getPersistentEntityId(queryObject))
.document(elasticsearchConverter.mapObject(queryObject));
} else if (query.getSource() != null) {
builder //
.id(query.getId()) //
builder
.id(query.getId())
.document(new DefaultStringObjectMap<>().fromJson(query.getSource()));
} else {
throw new InvalidDataAccessApiUsageException(
@@ -597,12 +596,13 @@ class RequestConverter {
Object queryObject = query.getObject();
if (queryObject != null) {
String id = StringUtils.hasText(query.getId()) ? query.getId() : getPersistentEntityId(queryObject);
builder //
.id(id) //
builder
.id(StringUtils.hasText(query.getId()) ? query.getId() : getPersistentEntityId(queryObject))
.document(elasticsearchConverter.mapObject(queryObject));
} else if (query.getSource() != null) {
builder.document(new DefaultStringObjectMap<>().fromJson(query.getSource()));
builder
.id(query.getId())
.document(new DefaultStringObjectMap<>().fromJson(query.getSource()));
} else {
throw new InvalidDataAccessApiUsageException(
"object or source is null, failed to index the document [id: " + query.getId() + ']');
@@ -638,12 +638,13 @@ class RequestConverter {
Object queryObject = query.getObject();
if (queryObject != null) {
String id = StringUtils.hasText(query.getId()) ? query.getId() : getPersistentEntityId(queryObject);
builder //
.id(id) //
builder
.id(StringUtils.hasText(query.getId()) ? query.getId() : getPersistentEntityId(queryObject))
.document(elasticsearchConverter.mapObject(queryObject));
} else if (query.getSource() != null) {
builder.document(new DefaultStringObjectMap<>().fromJson(query.getSource()));
builder
.id(query.getId())
.document(new DefaultStringObjectMap<>().fromJson(query.getSource()));
} else {
throw new InvalidDataAccessApiUsageException(
"object or source is null, failed to index the document [id: " + query.getId() + ']');
@@ -1682,8 +1683,13 @@ class RequestConverter {
} else // noinspection StatementWithEmptyBody
if (query instanceof StringQuery) {
// no filter for StringQuery
} else if (query instanceof NativeQuery) {
builder.postFilter(((NativeQuery) query).getFilter());
} else if (query instanceof NativeQuery nativeQuery) {
if (nativeQuery.getFilter() != null) {
builder.postFilter(nativeQuery.getFilter());
} else if (nativeQuery.getSpringDataQuery() != null) {
addFilter(nativeQuery.getSpringDataQuery(), builder);
}
} else {
throw new IllegalArgumentException("unhandled Query implementation " + query.getClass().getName());
}
@@ -169,8 +169,8 @@ public final class MappingParameters {
positiveScoreImpact = field.positiveScoreImpact();
dims = field.dims();
if (type == FieldType.Dense_Vector) {
Assert.isTrue(dims >= 1 && dims <= 2048,
"Invalid required parameter! Dense_Vector value \"dims\" must be between 1 and 2048.");
Assert.isTrue(dims >= 1 && dims <= 4096,
"Invalid required parameter! Dense_Vector value \"dims\" must be between 1 and 4096.");
}
Assert.isTrue(field.enabled() || type == FieldType.Object, "enabled false is only allowed for field type object");
enabled = field.enabled();
@@ -212,8 +212,8 @@ public final class MappingParameters {
positiveScoreImpact = field.positiveScoreImpact();
dims = field.dims();
if (type == FieldType.Dense_Vector) {
Assert.isTrue(dims >= 1 && dims <= 2048,
"Invalid required parameter! Dense_Vector value \"dims\" must be between 1 and 2048.");
Assert.isTrue(dims >= 1 && dims <= 4096,
"Invalid required parameter! Dense_Vector value \"dims\" must be between 1 and 4096.");
}
enabled = true;
eagerGlobalOrdinals = field.eagerGlobalOrdinals();
@@ -70,7 +70,7 @@ public class Order extends Sort.Order {
public Order(Sort.Direction direction, String property, Sort.NullHandling nullHandlingHint, @Nullable Mode mode,
@Nullable String unmappedType) {
this(direction, property, nullHandlingHint, null, unmappedType, null);
this(direction, property, nullHandlingHint, mode, unmappedType, null);
}
public Order(Sort.Direction direction, String property, Sort.NullHandling nullHandlingHint, @Nullable Mode mode,
@@ -453,9 +453,7 @@ public class SimpleElasticsearchRepository<T, ID> implements ElasticsearchReposi
@Nullable
public <R> R executeAndRefresh(OperationsCallback<R> callback, @Nullable RefreshPolicy refreshPolicy) {
R result = callback.doWithOperations(operations.withRefreshPolicy(refreshPolicy));
doRefresh();
return result;
return callback.doWithOperations(operations.withRefreshPolicy(refreshPolicy));
}
// endregion
}
+8 -1
View File
@@ -1,4 +1,4 @@
Spring Data Elasticsearch 5.2.2 (2023.1.2)
Spring Data Elasticsearch 5.2.9 (2023.1.9)
Copyright (c) [2013-2022] Pivotal Software, Inc.
This product is licensed to you under the Apache License, Version 2.0 (the "License").
@@ -20,3 +20,10 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
@@ -17,9 +17,9 @@ package org.springframework.data.elasticsearch.client;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import static io.specto.hoverfly.junit.dsl.HoverflyDsl.service;
import static io.specto.hoverfly.junit.verification.HoverflyVerifications.atLeast;
import static org.assertj.core.api.Assertions.assertThat;
import static io.specto.hoverfly.junit.dsl.HoverflyDsl.*;
import static io.specto.hoverfly.junit.verification.HoverflyVerifications.*;
import static org.assertj.core.api.Assertions.*;
import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.transport.endpoints.BooleanResponse;
@@ -51,6 +51,10 @@ import com.github.tomakehurst.wiremock.stubbing.StubMapping;
/**
* We need hoverfly for testing the reactive code to use a proxy. Wiremock cannot intercept the proxy calls as WebClient
* uses HTTP CONNECT on proxy requests which wiremock does not support.
* <br/>
* Note: since 5.0 we do not use the WebClient for
* the reactive code anymore, so this might be handled with two wiremocks, but there is no real need to change this test
* setup.
*
* @author Peter-Josef Meisch
*/
@@ -0,0 +1,140 @@
/*
* Copyright 2024 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.client.elc;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.*;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
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.client.ClientConfiguration;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.lang.Nullable;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
/**
* Tests that need to check the data produced by the Elasticsearch client
* @author Peter-Josef Meisch
*/
@ExtendWith(SpringExtension.class)
public class ELCWiremockTests {
@RegisterExtension static WireMockExtension wireMock = WireMockExtension.newInstance()
.options(wireMockConfig()
.dynamicPort()
// needed, otherwise Wiremock goes to test/resources/mappings
.usingFilesUnderDirectory("src/test/resources/wiremock-mappings"))
.build();
@Configuration
static class Config extends ElasticsearchConfiguration {
@Override
public ClientConfiguration clientConfiguration() {
return ClientConfiguration.builder()
.connectedTo("localhost:" + wireMock.getPort())
.build();
}
}
@Autowired ElasticsearchOperations operations;
@Test // #2839
@DisplayName("should store null values if configured")
void shouldStoreNullValuesIfConfigured() {
wireMock.stubFor(put(urlPathEqualTo("/null-fields/_doc/42"))
.withRequestBody(equalToJson("""
{
"_class": "org.springframework.data.elasticsearch.client.elc.ELCWiremockTests$EntityWithNullFields",
"id": "42",
"field1": null
}
"""))
.willReturn(
aResponse()
.withStatus(200)
.withHeader("X-elastic-product", "Elasticsearch")
.withHeader("content-type", "application/vnd.elasticsearch+json;compatible-with=8")
.withBody("""
{
"_index": "null-fields",
"_id": "42",
"_version": 1,
"result": "created",
"forced_refresh": true,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 1,
"_primary_term": 1
}
""")));
var entity = new EntityWithNullFields();
entity.setId("42");
operations.save(entity);
// no need to assert anything, if the field1:null is not sent, we run into a 404 error
}
@Document(indexName = "null-fields")
static class EntityWithNullFields {
@Nullable
@Id private String id;
@Nullable
@Field(storeNullValue = true) private String field1;
@Nullable
@Field private String field2;
@Nullable
public String getId() {
return id;
}
public void setId(@Nullable String id) {
this.id = id;
}
@Nullable
public String getField1() {
return field1;
}
public void setField1(@Nullable String field1) {
this.field1 = field1;
}
@Nullable
public String getField2() {
return field2;
}
public void setField2(@Nullable String field2) {
this.field2 = field2;
}
}
}
@@ -70,8 +70,8 @@ public class MappingParametersTest extends MappingContextBaseTests {
}
@Test // #1700
@DisplayName("should not allow dims length greater than 2048 for dense_vector type")
void shouldNotAllowDimsLengthGreaterThan2048ForDenseVectorType() {
@DisplayName("should not allow dims length greater than 4096 for dense_vector type")
void shouldNotAllowDimsLengthGreaterThan4096ForDenseVectorType() {
ElasticsearchPersistentEntity<?> failEntity = elasticsearchConverter.get().getMappingContext()
.getRequiredPersistentEntity(DenseVectorInvalidDimsClass.class);
Annotation annotation = failEntity.getRequiredPersistentProperty("dense_vector").findAnnotation(Field.class);
@@ -90,21 +90,28 @@ public class MappingParametersTest extends MappingContextBaseTests {
}
static class AnnotatedClass {
@Nullable @Field private String field;
@Nullable @MultiField(mainField = @Field,
@Nullable
@Field private String field;
@Nullable
@MultiField(mainField = @Field,
otherFields = { @InnerField(suffix = "test", type = FieldType.Text) }) private String mainField;
@Nullable @Field(type = FieldType.Text, docValues = false) private String docValuesText;
@Nullable @Field(type = FieldType.Nested, docValues = false) private String docValuesNested;
@Nullable @Field(type = Object, enabled = true) private String enabledObject;
@Nullable @Field(type = Object, enabled = false) private String disabledObject;
@Nullable
@Field(type = FieldType.Text, docValues = false) private String docValuesText;
@Nullable
@Field(type = FieldType.Nested, docValues = false) private String docValuesNested;
@Nullable
@Field(type = Object, enabled = true) private String enabledObject;
@Nullable
@Field(type = Object, enabled = false) private String disabledObject;
}
static class InvalidEnabledFieldClass {
@Nullable @Field(type = FieldType.Text, enabled = false) private String disabledObject;
@Nullable
@Field(type = FieldType.Text, enabled = false) private String disabledObject;
}
static class DenseVectorInvalidDimsClass {
@Field(type = Dense_Vector, dims = 2049) private float[] dense_vector;
@Field(type = Dense_Vector, dims = 4097) private float[] dense_vector;
}
static class DenseVectorMissingDimsClass {
@@ -28,6 +28,7 @@ import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.client.elc.NativeQuery;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest;
import org.springframework.data.elasticsearch.utils.IndexNameProvider;
@@ -50,7 +51,7 @@ public abstract class NativeQueryIntegrationTests {
@Test
@Order(java.lang.Integer.MAX_VALUE)
void cleanup() {
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + "*")).delete();
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + '*')).delete();
}
@Test // #2391
@@ -75,6 +76,28 @@ public abstract class NativeQueryIntegrationTests {
assertThat(searchHits.getSearchHit(0).getId()).isEqualTo(entity.getId());
}
@Test // #2840
@DisplayName("should be able to use CriteriaQuery with filter arguments in a NativeQuery")
void shouldBeAbleToUseCriteriaQueryWithFilterArgumentsInANativeQuery() {
var entity1 = new SampleEntity();
entity1.setId("60");
var location1 = new GeoPoint(60.0, 60.0);
entity1.setLocation(location1);
var entity2 = new SampleEntity();
entity2.setId("70");
var location70 = new GeoPoint(70.0, 70.0);
entity2.setLocation(location70);
operations.save(entity1, entity2);
var criteriaQuery = new CriteriaQuery(Criteria.where("location").within(location1, "10km"));
var nativeQuery = NativeQuery.builder().withQuery(criteriaQuery).build();
var searchHits = operations.search(nativeQuery, SampleEntity.class);
assertThat(searchHits.getTotalHits()).isEqualTo(1);
assertThat(searchHits.getSearchHit(0).getId()).isEqualTo(entity1.getId());
}
@Test // #2391
@DisplayName("should be able to use StringQuery in a NativeQuery")
void shouldBeAbleToUseStringQueryInANativeQuery() {
@@ -112,6 +135,14 @@ public abstract class NativeQueryIntegrationTests {
@Document(indexName = "#{@indexNameProvider.indexName()}")
static class SampleEntity {
@Nullable
@Id private String id;
@Nullable
@Field(type = FieldType.Text) private String text;
@Nullable private GeoPoint location;
@Nullable
public String getId() {
return id;
@@ -121,6 +152,7 @@ public abstract class NativeQueryIntegrationTests {
this.id = id;
}
@Nullable
public String getText() {
return text;
}
@@ -130,8 +162,12 @@ public abstract class NativeQueryIntegrationTests {
}
@Nullable
@Id private String id;
public GeoPoint getLocation() {
return location;
}
@Field(type = FieldType.Text) private String text;
public void setLocation(GeoPoint location) {
this.location = location;
}
}
}
@@ -132,7 +132,7 @@ public class ClusterConnection implements ExtensionContext.Store.CloseableResour
DockerImageName dockerImageName = getDockerImageName(testcontainersProperties);
ElasticsearchContainer elasticsearchContainer = new SpringDataElasticsearchContainer(dockerImageName)
.withEnv(testcontainersProperties).withStartupTimeout(Duration.ofMinutes(2));
.withEnv(testcontainersProperties).withStartupTimeout(Duration.ofMinutes(2)).withReuse(true);
elasticsearchContainer.start();
return ClusterConnectionInfo.builder() //
@@ -192,16 +192,7 @@ public class ClusterConnection implements ExtensionContext.Store.CloseableResour
@Override
public void close() {
if (clusterConnectionInfo != null && clusterConnectionInfo.getElasticsearchContainer() != null) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Stopping container");
}
clusterConnectionInfo.getElasticsearchContainer().stop();
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("closed");
}
}
private static class SpringDataElasticsearchContainer extends ElasticsearchContainer {
@@ -15,7 +15,7 @@
#
#
sde.testcontainers.image-name=docker.elastic.co/elasticsearch/elasticsearch
sde.testcontainers.image-version=8.11.3
sde.testcontainers.image-version=8.11.4
#
#
# 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