mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-08-03 16:13:26 +00:00
Compare commits
81 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ede29781da | ||
|
53a7af879a | ||
|
c7512fb325 | ||
|
b4fde9d48b | ||
|
8e56ef77b8 | ||
|
a2a4114d9c | ||
|
ec8401a2fb | ||
|
19ec05dae3 | ||
|
70d2de7eec | ||
|
1666fcee02 | ||
|
c513a0c03e | ||
|
22fe50c73a | ||
|
ef90755c27 | ||
|
9153d4dff4 | ||
|
9109dfa257 | ||
|
64eee02b85 | ||
|
31365fb722 | ||
|
c218c1d5e3 | ||
|
5bce5dd880 | ||
|
32c4c4d03f | ||
|
5102d98e10 | ||
|
57a4b755c1 | ||
|
edaae2a4e8 | ||
|
4747caf57a | ||
|
aba2ff6f5c | ||
|
0dc2902cab | ||
|
3c60e5f9cc | ||
|
ef822355ac | ||
|
94d23a1403 | ||
|
13b4d62031 | ||
|
1087b0355f | ||
|
22ed898d63 | ||
|
a474a0f533 | ||
|
1d23fb14fa | ||
|
e1741ca255 | ||
|
3e4477af16 | ||
|
2244f855f3 | ||
|
03265a4551 | ||
|
fdc03cf29e | ||
|
e1da43ca9f | ||
|
4a1a4d3851 | ||
|
a9ee467455 | ||
|
ebccb34db1 | ||
|
d1e349f689 | ||
|
b8722bab84 | ||
|
9e35f70833 | ||
|
59f3a6b120 | ||
|
e534e952a1 | ||
|
868a9d049a | ||
|
28727c6b36 | ||
|
89528e0e59 | ||
|
42e49e8ff7 | ||
|
b52fc2f0d7 | ||
|
1923721ebf | ||
|
8834cbfe03 | ||
|
2dabb2f89f | ||
|
40a91d01a8 | ||
|
aab18b55ab | ||
|
6351b9f026 | ||
|
7d5b9d5b7c | ||
|
5cf7b2baae | ||
|
b005c77cad | ||
|
d90d0ed71c | ||
|
5b3cf9af4c | ||
|
85a7ed7dc8 | ||
|
a64c24e64b | ||
|
bb071a18e7 | ||
|
5c1682b908 | ||
|
9583a05553 | ||
|
6551a80ccc | ||
|
1c3c09a80e | ||
|
ec66dfebdd | ||
|
be0327894a | ||
|
4bf1435555 | ||
|
8fe04172f6 | ||
|
03b522d956 | ||
|
bf317bc6a7 | ||
|
ea3aa135e4 | ||
|
5c848e4641 | ||
|
1b7c16ab03 | ||
|
0bcb86a03d |
4
.mvn/wrapper/maven-wrapper.properties
vendored
4
.mvn/wrapper/maven-wrapper.properties
vendored
@ -1,3 +1,3 @@
|
|||||||
#Fri Jun 03 09:32:51 CEST 2022
|
#Mon Aug 14 07:45:53 EDT 2023
|
||||||
wrapperUrl=https\://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
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.8.5/apache-maven-3.8.5-bin.zip
|
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
|
||||||
|
69
Jenkinsfile
vendored
69
Jenkinsfile
vendored
@ -1,7 +1,7 @@
|
|||||||
def p = [:]
|
def p = [:]
|
||||||
node {
|
node {
|
||||||
checkout scm
|
checkout scm
|
||||||
p = readProperties interpolate: true, file: 'ci/pipeline.properties'
|
p = readProperties interpolate: true, file: 'ci/pipeline.properties'
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
@ -9,7 +9,7 @@ pipeline {
|
|||||||
|
|
||||||
triggers {
|
triggers {
|
||||||
pollSCM 'H/10 * * * *'
|
pollSCM 'H/10 * * * *'
|
||||||
upstream(upstreamProjects: "spring-data-commons/main", threshold: hudson.model.Result.SUCCESS)
|
upstream(upstreamProjects: "spring-data-commons/3.0.x", threshold: hudson.model.Result.SUCCESS)
|
||||||
}
|
}
|
||||||
|
|
||||||
options {
|
options {
|
||||||
@ -18,7 +18,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage("test: baseline (Java 17)") {
|
stage("test: baseline (main)") {
|
||||||
when {
|
when {
|
||||||
beforeAgent(true)
|
beforeAgent(true)
|
||||||
anyOf {
|
anyOf {
|
||||||
@ -32,17 +32,42 @@ pipeline {
|
|||||||
options { timeout(time: 30, unit: 'MINUTES') }
|
options { timeout(time: 30, unit: 'MINUTES') }
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
DOCKER_HUB = credentials("${p['docker.credentials']}")
|
|
||||||
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
|
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
|
||||||
}
|
}
|
||||||
|
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
|
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
|
||||||
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
|
sh 'PROFILE=none ci/verify.sh'
|
||||||
sh "docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}"
|
sh "ci/clean.sh"
|
||||||
sh 'PROFILE=none ci/verify.sh'
|
}
|
||||||
sh "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']}")
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) {
|
||||||
|
sh 'PROFILE=none ci/verify.sh'
|
||||||
|
sh "ci/clean.sh"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,17 +93,15 @@ pipeline {
|
|||||||
|
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
|
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
|
||||||
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
|
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch-non-root ' +
|
||||||
sh 'MAVEN_OPTS="-Duser.name=jenkins -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=https://repo.spring.io ' +
|
||||||
'-Dartifactory.server=https://repo.spring.io ' +
|
"-Dartifactory.username=${ARTIFACTORY_USR} " +
|
||||||
"-Dartifactory.username=${ARTIFACTORY_USR} " +
|
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
|
||||||
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
|
"-Dartifactory.staging-repository=libs-snapshot-local " +
|
||||||
"-Dartifactory.staging-repository=libs-snapshot-local " +
|
"-Dartifactory.build-name=spring-data-elasticsearch " +
|
||||||
"-Dartifactory.build-name=spring-data-elasticsearch " +
|
"-Dartifactory.build-number=${BUILD_NUMBER} " +
|
||||||
"-Dartifactory.build-number=${BUILD_NUMBER} " +
|
'-Dmaven.test.skip=true clean deploy -U -B'
|
||||||
'-Dmaven.test.skip=true clean deploy -U -B'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,10 +111,6 @@ pipeline {
|
|||||||
post {
|
post {
|
||||||
changed {
|
changed {
|
||||||
script {
|
script {
|
||||||
slackSend(
|
|
||||||
color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger',
|
|
||||||
channel: '#spring-data-dev',
|
|
||||||
message: "${currentBuild.fullDisplayName} - `${currentBuild.currentResult}`\n${env.BUILD_URL}")
|
|
||||||
emailext(
|
emailext(
|
||||||
subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}",
|
subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}",
|
||||||
mimeType: 'text/html',
|
mimeType: 'text/html',
|
||||||
|
@ -137,9 +137,9 @@ To use the Release candidate versions of the upcoming major version, use our Mav
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>spring-libs-snapshot</id>
|
<id>spring-snapshot</id>
|
||||||
<name>Spring Snapshot Repository</name>
|
<name>Spring Snapshot Repository</name>
|
||||||
<url>https://repo.spring.io/libs-milestone</url>
|
<url>https://repo.spring.io/milestone</url>
|
||||||
</repository>
|
</repository>
|
||||||
----
|
----
|
||||||
|
|
||||||
@ -154,9 +154,9 @@ If you'd rather like the latest snapshots of the upcoming major version, use our
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>spring-libs-snapshot</id>
|
<id>spring-snapshot</id>
|
||||||
<name>Spring Snapshot Repository</name>
|
<name>Spring Snapshot Repository</name>
|
||||||
<url>https://repo.spring.io/libs-snapshot</url>
|
<url>https://repo.spring.io/snapshot</url>
|
||||||
</repository>
|
</repository>
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
# Java versions
|
# Java versions
|
||||||
java.main.tag=17.0.4.1_1-jdk-focal
|
java.main.tag=17.0.8_7-jdk-focal
|
||||||
|
java.next.tag=20-jdk-jammy
|
||||||
|
|
||||||
# Docker container images - standard
|
# Docker container images - standard
|
||||||
docker.java.main.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.main.tag}
|
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}
|
||||||
|
|
||||||
# Supported versions of MongoDB
|
# Supported versions of MongoDB
|
||||||
docker.mongodb.4.4.version=4.4.17
|
docker.mongodb.4.4.version=4.4.23
|
||||||
docker.mongodb.5.0.version=5.0.13
|
docker.mongodb.5.0.version=5.0.19
|
||||||
docker.mongodb.6.0.version=6.0.2
|
docker.mongodb.6.0.version=6.0.8
|
||||||
|
|
||||||
# Supported versions of Redis
|
# Supported versions of Redis
|
||||||
docker.redis.6.version=6.2.6
|
docker.redis.6.version=6.2.13
|
||||||
|
|
||||||
# Supported versions of Cassandra
|
# Supported versions of Cassandra
|
||||||
docker.cassandra.3.version=3.11.14
|
docker.cassandra.3.version=3.11.15
|
||||||
|
|
||||||
# Docker environment settings
|
# Docker environment settings
|
||||||
docker.java.inside.basic=-v $HOME:/tmp/jenkins-home
|
docker.java.inside.basic=-v $HOME:/tmp/jenkins-home
|
||||||
|
47
pom.xml
47
pom.xml
@ -5,12 +5,12 @@
|
|||||||
|
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-elasticsearch</artifactId>
|
<artifactId>spring-data-elasticsearch</artifactId>
|
||||||
<version>5.0.0</version>
|
<version>5.0.9</version>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.data.build</groupId>
|
<groupId>org.springframework.data.build</groupId>
|
||||||
<artifactId>spring-data-parent</artifactId>
|
<artifactId>spring-data-parent</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.9</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<name>Spring Data Elasticsearch</name>
|
<name>Spring Data Elasticsearch</name>
|
||||||
@ -18,17 +18,17 @@
|
|||||||
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>
|
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<springdata.commons>3.0.0</springdata.commons>
|
<springdata.commons>3.0.9</springdata.commons>
|
||||||
|
|
||||||
<!-- version of the RestHighLevelClient -->
|
<!-- version of the RestHighLevelClient -->
|
||||||
<elasticsearch-rhlc>7.17.7</elasticsearch-rhlc>
|
<elasticsearch-rhlc>7.17.12</elasticsearch-rhlc>
|
||||||
<!-- version of the new ElasticsearchClient -->
|
<!-- version of the new ElasticsearchClient -->
|
||||||
<elasticsearch-java>8.5.0</elasticsearch-java>
|
<elasticsearch-java>8.5.3</elasticsearch-java>
|
||||||
|
|
||||||
<log4j>2.18.0</log4j>
|
<log4j>2.18.0</log4j>
|
||||||
<netty>4.1.65.Final</netty>
|
<netty>4.1.65.Final</netty>
|
||||||
|
|
||||||
<blockhound-junit>1.0.6.RELEASE</blockhound-junit>
|
<blockhound-junit>1.0.7.RELEASE</blockhound-junit>
|
||||||
<hoverfly>0.14.3</hoverfly>
|
<hoverfly>0.14.3</hoverfly>
|
||||||
<jsonassert>1.5.1</jsonassert>
|
<jsonassert>1.5.1</jsonassert>
|
||||||
<testcontainers>1.17.3</testcontainers>
|
<testcontainers>1.17.3</testcontainers>
|
||||||
@ -279,24 +279,6 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
we don't use lombok in Spring Data Elasticsearch anymore. But the dependency is set in the parent project, and so the
|
|
||||||
lombok compiler stuff is executed regardless of the fact that we don't need it.
|
|
||||||
On AdoptOpenJdk 16.0.0 this leads to an error, so the project does not build.
|
|
||||||
Therefore we replace lombok with a jar - that just contains an empty file - that lives in a local maven repository in
|
|
||||||
src/test/resources/local-maven-repo/
|
|
||||||
It was installed with
|
|
||||||
mvn deploy:deploy-file -DgroupId=org.projectlombok -DartifactId=lombok -Dversion=999999 -Durl=file:./src/test/resources/local-maven-repo/ -DrepositoryId=local-maven-repo -DupdateReleaseInfo=true -Dfile=path/to/empty.jar
|
|
||||||
-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<!--suppress MavenPackageUpdate -->
|
|
||||||
<version>999999</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.skyscreamer</groupId>
|
<groupId>org.skyscreamer</groupId>
|
||||||
<artifactId>jsonassert</artifactId>
|
<artifactId>jsonassert</artifactId>
|
||||||
@ -466,7 +448,7 @@
|
|||||||
<groupId>org.asciidoctor</groupId>
|
<groupId>org.asciidoctor</groupId>
|
||||||
<artifactId>asciidoctor-maven-plugin</artifactId>
|
<artifactId>asciidoctor-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
@ -519,23 +501,8 @@
|
|||||||
</profiles>
|
</profiles>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
|
||||||
<id>spring-libs-release</id>
|
|
||||||
<url>https://repo.spring.io/libs-release</url>
|
|
||||||
</repository>
|
|
||||||
|
|
||||||
<repository>
|
|
||||||
<id>local-maven-repo</id>
|
|
||||||
<url>file:///${project.basedir}/src/test/resources/local-maven-repo</url>
|
|
||||||
</repository>
|
|
||||||
|
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<pluginRepositories>
|
|
||||||
<pluginRepository>
|
|
||||||
<id>spring-plugins-release</id>
|
|
||||||
<url>https://repo.spring.io/plugins-release</url>
|
|
||||||
</pluginRepository>
|
|
||||||
</pluginRepositories>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -17,9 +17,9 @@ include::reference/elasticsearch-new.adoc[leveloffset=+1]
|
|||||||
* Version Control - https://github.com/spring-projects/spring-data-elasticsearch
|
* Version Control - https://github.com/spring-projects/spring-data-elasticsearch
|
||||||
* API Documentation - https://docs.spring.io/spring-data/elasticsearch/docs/current/api/
|
* API Documentation - https://docs.spring.io/spring-data/elasticsearch/docs/current/api/
|
||||||
* Bugtracker - https://github.com/spring-projects/spring-data-elasticsearch/issues
|
* Bugtracker - https://github.com/spring-projects/spring-data-elasticsearch/issues
|
||||||
* Release repository - https://repo.spring.io/libs-release
|
* Release repository - https://repo1.maven.org/maven2/
|
||||||
* Milestone repository - https://repo.spring.io/libs-milestone
|
* Milestone repository - https://repo.spring.io/milestone/
|
||||||
* Snapshot repository - https://repo.spring.io/libs-snapshot
|
* Snapshot repository - https://repo.spring.io/snapshot/
|
||||||
|
|
||||||
[[preface.requirements]]
|
[[preface.requirements]]
|
||||||
== Requirements
|
== Requirements
|
||||||
@ -37,7 +37,7 @@ built and tested.
|
|||||||
[cols="^,^,^,^,^",options="header"]
|
[cols="^,^,^,^,^",options="header"]
|
||||||
|===
|
|===
|
||||||
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework | Spring Boot
|
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework | Spring Boot
|
||||||
| 2022.0 (Turing) | 5.0.x | 8.5.0 | 6.0.x | 3.0.x
|
| 2022.0 (Turing) | 5.0.x | 8.5.3 | 6.0.x | 3.0.x
|
||||||
| 2021.2 (Raj) | 4.4.x | 7.17.3 | 5.3.x | 2.7.x
|
| 2021.2 (Raj) | 4.4.x | 7.17.3 | 5.3.x | 2.7.x
|
||||||
| 2021.1 (Q) | 4.3.x | 7.15.2 | 5.3.x | 2.6.x
|
| 2021.1 (Q) | 4.3.x | 7.15.2 | 5.3.x | 2.6.x
|
||||||
| 2021.0 (Pascal) | 4.2.xfootnote:oom[Out of maintenance] | 7.12.0 | 5.3.x | 2.5.x
|
| 2021.0 (Pascal) | 4.2.xfootnote:oom[Out of maintenance] | 7.12.0 | 5.3.x | 2.5.x
|
||||||
|
@ -154,7 +154,7 @@ The old deprecated `RestHighLevelClient` can still be used, but you will need to
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.elasticsearch.client</groupId>
|
<groupId>org.elasticsearch.client</groupId>
|
||||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||||
<version>7.17.5</version>
|
<version>7.17.12</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>commons-logging</groupId>
|
<groupId>commons-logging</groupId>
|
||||||
@ -165,4 +165,4 @@ The old deprecated `RestHighLevelClient` can still be used, but you will need to
|
|||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
Make sure to specify the version 7.17.6 explicitly, otherwise maven will resolve to 8.5.0, and this does not exist.
|
Make sure to specify the version 7.17.12 explicitly, otherwise maven will resolve to 8.5.3, and this does not exist.
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
[[new-features]]
|
[[new-features]]
|
||||||
= What's new
|
= What's new
|
||||||
|
|
||||||
|
[[new-features.5-0-1]]
|
||||||
|
== New in Spring Data Elasticsearch 5.0.1
|
||||||
|
|
||||||
|
* Upgrade to Elasticsearch 8.5.3
|
||||||
|
|
||||||
[[new-features.5-0-0]]
|
[[new-features.5-0-0]]
|
||||||
== New in Spring Data Elasticsearch 5.0
|
== New in Spring Data Elasticsearch 5.0
|
||||||
|
|
||||||
* Upgrade to Java 17 baseline
|
* Upgrade to Java 17 baseline
|
||||||
* Upgrade to Spring Framework 6
|
* Upgrade to Spring Framework 6
|
||||||
* Upograde to Elasticsearch 8.5.0
|
* Upgrade to Elasticsearch 8.5.0
|
||||||
* Use the new Elasticsearch client library
|
* Use the new Elasticsearch client library
|
||||||
|
|
||||||
[[new-features.4-4-0]]
|
[[new-features.4-4-0]]
|
||||||
|
@ -29,7 +29,7 @@ See <<elasticsearch.repositories.autocreation>>
|
|||||||
|
|
||||||
|
|
||||||
* `@Id`: Applied at the field level to mark the field used for identity purpose.
|
* `@Id`: Applied at the field level to mark the field used for identity purpose.
|
||||||
* `@Transient`: By default all fields are mapped to the document when it is stored or retrieved, this annotation excludes the field.
|
* `@Transient`, `@ReadOnlyProperty`, `@WriteOnlyProperty`: see the following section <<elasticsearch.mapping.meta-model.annotations.read-write>> for detailed information.
|
||||||
* `@PersistenceConstructor`: Marks a given constructor - even a package protected one - to use when instantiating the object from the database.
|
* `@PersistenceConstructor`: Marks a given constructor - even a package protected one - to use when instantiating the object from the database.
|
||||||
Constructor arguments are mapped by name to the key values in the retrieved Document.
|
Constructor arguments are mapped by name to the key values in the retrieved Document.
|
||||||
* `@Field`: Applied at the field level and defines properties of the field, most of the attributes map to the respective https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html[Elasticsearch Mapping] definitions (the following list is not complete, check the annotation Javadoc for a complete reference):
|
* `@Field`: Applied at the field level and defines properties of the field, most of the attributes map to the respective https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html[Elasticsearch Mapping] definitions (the following list is not complete, check the annotation Javadoc for a complete reference):
|
||||||
@ -49,6 +49,25 @@ In difference to a registered Spring `Converter` this only converts the annotate
|
|||||||
|
|
||||||
The mapping metadata infrastructure is defined in a separate spring-data-commons project that is technology agnostic.
|
The mapping metadata infrastructure is defined in a separate spring-data-commons project that is technology agnostic.
|
||||||
|
|
||||||
|
[[elasticsearch.mapping.meta-model.annotations.read-write]]
|
||||||
|
==== Controlling which properties are written to and read from Elasticsearch
|
||||||
|
|
||||||
|
This section details the annotations that define if the value of a property is written to or
|
||||||
|
read from Elasticsearch.
|
||||||
|
|
||||||
|
`@Transient`: A property annotated with this annotation will not be written to the mapping, it's value will not be
|
||||||
|
sent to Elasticsearch and when documents are returned from Elasticsearch, this property will not be set in the
|
||||||
|
resulting entity.
|
||||||
|
|
||||||
|
`@ReadOnlyProperty`: A property with this annotaiton will not have its value written to Elasticsearch, but when
|
||||||
|
returning data, the proeprty will be filled with the value returned in the document from Elasticsearch. One use case
|
||||||
|
for this are runtime fields defined in the index mapping.
|
||||||
|
|
||||||
|
`@WriteOnlyProperty`: A property with this annotaiton will have its value stored in Elasticsearch but will not be set
|
||||||
|
with any value when reading document. This can be used for example for synthesized fields which should go into the
|
||||||
|
Elasticsearch index but are not used elsewhere.
|
||||||
|
|
||||||
|
|
||||||
[[elasticsearch.mapping.meta-model.annotations.date-formats]]
|
[[elasticsearch.mapping.meta-model.annotations.date-formats]]
|
||||||
==== Date format mapping
|
==== Date format mapping
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2022 the original author or authors.
|
* Copyright 2020-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2022 the original author or authors.
|
* Copyright 2019-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2022 the original author or authors.
|
* Copyright 2020-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2022 the original author or authors.
|
* Copyright 2019-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2022 the original author or authors.
|
* Copyright 2013-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014-2022 the original author or authors.
|
* Copyright 2014-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2022 the original author or authors.
|
* Copyright 2013-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2022 the original author or authors.
|
* Copyright 2013-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2022 the original author or authors.
|
* Copyright 2013-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2022 the original author or authors.
|
* Copyright 2013-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2017-2022 the original author or authors.
|
* Copyright 2017-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2022 the original author or authors.
|
* Copyright 2020-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2022 the original author or authors.
|
* Copyright 2020-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2022 the original author or authors.
|
* Copyright 2020-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2022 the original author or authors.
|
* Copyright 2019-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2022 the original author or authors.
|
* Copyright 2019-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014-2022 the original author or authors.
|
* Copyright 2014-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2022 the original author or authors.
|
* Copyright 2020-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2022 the original author or authors.
|
* Copyright 2020-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014-2022 the original author or authors.
|
* Copyright 2014-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014-2022 the original author or authors.
|
* Copyright 2014-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2022 the original author or authors.
|
* Copyright 2020-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2022 the original author or authors.
|
* Copyright 2013-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2014-2022 the original author or authors.
|
* Copyright 2014-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2022 the original author or authors.
|
* Copyright 2019-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2022 the original author or authors.
|
* Copyright 2019-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 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.aot;
|
||||||
|
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
import org.springframework.data.util.ReactiveWrappers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Peter-Josef Meisch
|
||||||
|
* @since 5.0.1
|
||||||
|
*/
|
||||||
|
public class ElasticsearchAotPredicates {
|
||||||
|
|
||||||
|
public static final Predicate<ReactiveWrappers.ReactiveLibrary> IS_REACTIVE_LIBARARY_AVAILABLE = (
|
||||||
|
lib) -> ReactiveWrappers.isAvailable(lib);
|
||||||
|
|
||||||
|
public static boolean isReactorPresent() {
|
||||||
|
return IS_REACTIVE_LIBARARY_AVAILABLE.test(ReactiveWrappers.ReactiveLibrary.PROJECT_REACTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 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.aot;
|
||||||
|
|
||||||
|
import static org.springframework.data.elasticsearch.aot.ElasticsearchAotPredicates.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.springframework.aot.hint.MemberCategory;
|
||||||
|
import org.springframework.aot.hint.RuntimeHints;
|
||||||
|
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||||
|
import org.springframework.aot.hint.TypeReference;
|
||||||
|
import org.springframework.data.elasticsearch.client.elc.EntityAsMap;
|
||||||
|
import org.springframework.data.elasticsearch.core.event.AfterConvertCallback;
|
||||||
|
import org.springframework.data.elasticsearch.core.event.AfterLoadCallback;
|
||||||
|
import org.springframework.data.elasticsearch.core.event.AfterSaveCallback;
|
||||||
|
import org.springframework.data.elasticsearch.core.event.AuditingEntityCallback;
|
||||||
|
import org.springframework.data.elasticsearch.core.event.BeforeConvertCallback;
|
||||||
|
import org.springframework.data.elasticsearch.core.event.ReactiveAfterConvertCallback;
|
||||||
|
import org.springframework.data.elasticsearch.core.event.ReactiveAfterLoadCallback;
|
||||||
|
import org.springframework.data.elasticsearch.core.event.ReactiveAfterSaveCallback;
|
||||||
|
import org.springframework.data.elasticsearch.core.event.ReactiveAuditingEntityCallback;
|
||||||
|
import org.springframework.data.elasticsearch.core.event.ReactiveBeforeConvertCallback;
|
||||||
|
import org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Peter-Josef Meisch
|
||||||
|
* @since 5.0.1
|
||||||
|
*/
|
||||||
|
public class ElasticsearchRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||||
|
hints.reflection().registerTypes( //
|
||||||
|
Arrays.asList( //
|
||||||
|
TypeReference.of(AfterConvertCallback.class), //
|
||||||
|
TypeReference.of(AfterLoadCallback.class), //
|
||||||
|
TypeReference.of(AfterSaveCallback.class), //
|
||||||
|
TypeReference.of(BeforeConvertCallback.class), //
|
||||||
|
TypeReference.of(EntityAsMap.class) //
|
||||||
|
), //
|
||||||
|
builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
|
||||||
|
MemberCategory.INVOKE_PUBLIC_METHODS));
|
||||||
|
|
||||||
|
if (isReactorPresent()) {
|
||||||
|
hints.reflection().registerTypes( //
|
||||||
|
Arrays.asList( //
|
||||||
|
TypeReference.of(ReactiveAfterConvertCallback.class), //
|
||||||
|
TypeReference.of(ReactiveAfterLoadCallback.class), //
|
||||||
|
TypeReference.of(ReactiveAfterSaveCallback.class), //
|
||||||
|
TypeReference.of(ReactiveBeforeConvertCallback.class) //
|
||||||
|
), //
|
||||||
|
builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
|
||||||
|
MemberCategory.INVOKE_PUBLIC_METHODS));
|
||||||
|
}
|
||||||
|
|
||||||
|
// properties needed to log the different versions
|
||||||
|
hints.resources().registerPattern("versions.properties");
|
||||||
|
hints.resources().registerPattern("co/elastic/clients/version.properties");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
@org.springframework.lang.NonNullApi
|
||||||
|
@org.springframework.lang.NonNullFields
|
||||||
|
package org.springframework.data.elasticsearch.aot;
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2022 the original author or authors.
|
* Copyright 2018-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2022 the original author or authors.
|
* Copyright 2018-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2022 the original author or authors.
|
* Copyright 2018-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2022 the original author or authors.
|
* Copyright 2018-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2022 the original author or authors.
|
* Copyright 2018-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2022 the original author or authors.
|
* Copyright 2018-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2022 the original author or authors.
|
* Copyright 2018-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -74,13 +74,15 @@ public class ElasticsearchExceptionTranslator implements PersistenceExceptionTra
|
|||||||
if (ex instanceof ElasticsearchException elasticsearchException) {
|
if (ex instanceof ElasticsearchException elasticsearchException) {
|
||||||
|
|
||||||
ErrorResponse response = elasticsearchException.response();
|
ErrorResponse response = elasticsearchException.response();
|
||||||
|
var errorType = response.error().type();
|
||||||
|
var errorReason = response.error().reason() != null ? response.error().reason() : "undefined reason";
|
||||||
|
|
||||||
if (response.status() == 404 && "index_not_found_exception".equals(response.error().type())) {
|
if (response.status() == 404 && "index_not_found_exception".equals(errorType)) {
|
||||||
|
|
||||||
// noinspection RegExpRedundantEscape
|
// noinspection RegExpRedundantEscape
|
||||||
Pattern pattern = Pattern.compile(".*no such index \\[(.*)\\]");
|
Pattern pattern = Pattern.compile(".*no such index \\[(.*)\\]");
|
||||||
String index = "";
|
String index = "";
|
||||||
Matcher matcher = pattern.matcher(response.error().reason());
|
Matcher matcher = pattern.matcher(errorReason);
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
index = matcher.group(1);
|
index = matcher.group(1);
|
||||||
}
|
}
|
||||||
@ -88,8 +90,8 @@ public class ElasticsearchExceptionTranslator implements PersistenceExceptionTra
|
|||||||
}
|
}
|
||||||
String body = JsonUtils.toJson(response, jsonpMapper);
|
String body = JsonUtils.toJson(response, jsonpMapper);
|
||||||
|
|
||||||
if (response.error().type().contains("validation_exception")) {
|
if (errorType != null && errorType.contains("validation_exception")) {
|
||||||
return new DataIntegrityViolationException(response.error().reason());
|
return new DataIntegrityViolationException(errorReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UncategorizedElasticsearchException(ex.getMessage(), response.status(), body, ex);
|
return new UncategorizedElasticsearchException(ex.getMessage(), response.status(), body, ex);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -296,7 +296,7 @@ public class ElasticsearchTemplate extends AbstractElasticsearchTemplate {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRuntimeLibraryVersion() {
|
public String getRuntimeLibraryVersion() {
|
||||||
return Version.VERSION.toString();
|
return Version.VERSION != null ? Version.VERSION.toString() : "0.0.0.?";
|
||||||
}
|
}
|
||||||
|
|
||||||
// region search operations
|
// region search operations
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -184,7 +184,7 @@ public class NativeQueryBuilder extends BaseQueryBuilder<NativeQuery, NativeQuer
|
|||||||
|
|
||||||
Assert.notNull(searchExtensions, "searchExtensions must not be null");
|
Assert.notNull(searchExtensions, "searchExtensions must not be null");
|
||||||
|
|
||||||
searchExtensions.putAll(searchExtensions);
|
this.searchExtensions.putAll(searchExtensions);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -115,7 +115,7 @@ public class ReactiveElasticsearchTemplate extends AbstractReactiveElasticsearch
|
|||||||
|
|
||||||
return entitiesPublisher //
|
return entitiesPublisher //
|
||||||
.flatMapMany(entities -> Flux.fromIterable(entities) //
|
.flatMapMany(entities -> Flux.fromIterable(entities) //
|
||||||
.concatMap(entity -> maybeCallBeforeConvert(entity, index)) //
|
.concatMap(entity -> maybeCallbackBeforeConvert(entity, index)) //
|
||||||
).collectList() //
|
).collectList() //
|
||||||
.map(Entities::new) //
|
.map(Entities::new) //
|
||||||
.flatMapMany(entities -> {
|
.flatMapMany(entities -> {
|
||||||
@ -131,7 +131,7 @@ public class ReactiveElasticsearchTemplate extends AbstractReactiveElasticsearch
|
|||||||
BulkResponseItem response = indexAndResponse.getT2();
|
BulkResponseItem response = indexAndResponse.getT2();
|
||||||
updateIndexedObject(savedEntity, IndexedObjectInformation.of(response.id(), response.seqNo(),
|
updateIndexedObject(savedEntity, IndexedObjectInformation.of(response.id(), response.seqNo(),
|
||||||
response.primaryTerm(), response.version()));
|
response.primaryTerm(), response.version()));
|
||||||
return maybeCallAfterSave(savedEntity, index);
|
return maybeCallbackAfterSave(savedEntity, index);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -329,8 +329,8 @@ public class ReactiveElasticsearchTemplate extends AbstractReactiveElasticsearch
|
|||||||
|
|
||||||
Flux<ResponseBody<EntityAsMap>> searchResponses = Flux.usingWhen(Mono.fromSupplier(ScrollState::new), //
|
Flux<ResponseBody<EntityAsMap>> searchResponses = Flux.usingWhen(Mono.fromSupplier(ScrollState::new), //
|
||||||
state -> Mono
|
state -> Mono
|
||||||
.from(execute((ClientCallback<Publisher<ResponseBody<EntityAsMap>>>) client1 -> client1
|
.from(execute((ClientCallback<Publisher<ResponseBody<EntityAsMap>>>) client -> client.search(searchRequest,
|
||||||
.search(searchRequest, EntityAsMap.class))) //
|
EntityAsMap.class))) //
|
||||||
.expand(entityAsMapSearchResponse -> {
|
.expand(entityAsMapSearchResponse -> {
|
||||||
|
|
||||||
state.updateScrollId(entityAsMapSearchResponse.scrollId());
|
state.updateScrollId(entityAsMapSearchResponse.scrollId());
|
||||||
@ -354,6 +354,10 @@ public class ReactiveElasticsearchTemplate extends AbstractReactiveElasticsearch
|
|||||||
|
|
||||||
private Publisher<?> cleanupScroll(ScrollState state) {
|
private Publisher<?> cleanupScroll(ScrollState state) {
|
||||||
|
|
||||||
|
if (state.getScrollIds().isEmpty()) {
|
||||||
|
return Mono.empty();
|
||||||
|
}
|
||||||
|
|
||||||
return execute((ClientCallback<Publisher<ClearScrollResponse>>) client -> client
|
return execute((ClientCallback<Publisher<ClearScrollResponse>>) client -> client
|
||||||
.clearScroll(ClearScrollRequest.of(csr -> csr.scrollId(state.getScrollIds()))));
|
.clearScroll(ClearScrollRequest.of(csr -> csr.scrollId(state.getScrollIds()))));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -154,7 +154,8 @@ public class ReactiveIndicesTemplate
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mono<Void> refresh() {
|
public Mono<Void> refresh() {
|
||||||
return Mono.from(execute(ReactiveElasticsearchIndicesClient::refresh)).then();
|
RefreshRequest refreshRequest = requestConverter.indicesRefreshRequest(getIndexCoordinates());
|
||||||
|
return Mono.from(execute(client -> client.refresh(refreshRequest))).then();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -78,6 +78,7 @@ import jakarta.json.stream.JsonParser;
|
|||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.StringReader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -132,6 +133,7 @@ import org.springframework.util.StringUtils;
|
|||||||
* @author Peter-Josef Meisch
|
* @author Peter-Josef Meisch
|
||||||
* @author Sascha Woo
|
* @author Sascha Woo
|
||||||
* @author cdalxndr
|
* @author cdalxndr
|
||||||
|
* @author scoobyzhang
|
||||||
* @since 4.4
|
* @since 4.4
|
||||||
*/
|
*/
|
||||||
class RequestConverter {
|
class RequestConverter {
|
||||||
@ -175,14 +177,12 @@ class RequestConverter {
|
|||||||
createRequestBuilder.index(indexCoordinates.getIndexName());
|
createRequestBuilder.index(indexCoordinates.getIndexName());
|
||||||
|
|
||||||
// note: the new client does not support the index.storeType anymore
|
// note: the new client does not support the index.storeType anymore
|
||||||
String settingsJson = Document.from(settings).toJson();
|
createRequestBuilder.settings(IndexSettings.of(b -> b //
|
||||||
IndexSettings indexSettings = fromJson(settingsJson, IndexSettings._DESERIALIZER);
|
.withJson(new StringReader(Document.from(settings).toJson()))));
|
||||||
createRequestBuilder.settings(indexSettings);
|
|
||||||
|
|
||||||
if (mapping != null) {
|
if (mapping != null) {
|
||||||
String mappingJson = mapping.toJson();
|
createRequestBuilder.mappings(TypeMapping.of(b -> b //
|
||||||
TypeMapping typeMapping = fromJson(mappingJson, TypeMapping._DESERIALIZER);
|
.withJson(new StringReader(mapping.toJson()))));
|
||||||
createRequestBuilder.mappings(typeMapping);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return createRequestBuilder.build();
|
return createRequestBuilder.build();
|
||||||
@ -274,11 +274,12 @@ class RequestConverter {
|
|||||||
Assert.notNull(indexCoordinates, "indexCoordinates must not be null");
|
Assert.notNull(indexCoordinates, "indexCoordinates must not be null");
|
||||||
Assert.notNull(mapping, "mapping must not be null");
|
Assert.notNull(mapping, "mapping must not be null");
|
||||||
|
|
||||||
PutMappingRequest.Builder builder = new PutMappingRequest.Builder();
|
PutMappingRequest request = new PutMappingRequest.Builder() //
|
||||||
builder.index(Arrays.asList(indexCoordinates.getIndexNames()));
|
.withJson(new StringReader(mapping.toJson())) //
|
||||||
addPropertiesToMapping(builder, mapping);
|
.index(Arrays.asList(indexCoordinates.getIndexNames())) //
|
||||||
|
.build();
|
||||||
|
|
||||||
return builder.build();
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetMappingRequest indicesGetMappingRequest(IndexCoordinates indexCoordinates) {
|
public GetMappingRequest indicesGetMappingRequest(IndexCoordinates indexCoordinates) {
|
||||||
@ -288,23 +289,6 @@ class RequestConverter {
|
|||||||
return new GetMappingRequest.Builder().index(Arrays.asList(indexCoordinates.getIndexNames())).build();
|
return new GetMappingRequest.Builder().index(Arrays.asList(indexCoordinates.getIndexNames())).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPropertiesToMapping(PutMappingRequest.Builder builder, Document mapping) {
|
|
||||||
Object properties = mapping.get("properties");
|
|
||||||
|
|
||||||
if (properties != null) {
|
|
||||||
|
|
||||||
if (properties instanceof Map) {
|
|
||||||
Map<String, Property> propertiesMap = new HashMap<>();
|
|
||||||
// noinspection unchecked
|
|
||||||
((Map<String, Object>) properties).forEach((key, value) -> {
|
|
||||||
Property property = getProperty(value);
|
|
||||||
propertiesMap.put(key, property);
|
|
||||||
});
|
|
||||||
builder.properties(propertiesMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Property getProperty(Object value) {
|
private Property getProperty(Object value) {
|
||||||
// noinspection SpellCheckingInspection
|
// noinspection SpellCheckingInspection
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
@ -476,7 +460,7 @@ class RequestConverter {
|
|||||||
Object queryObject = query.getObject();
|
Object queryObject = query.getObject();
|
||||||
|
|
||||||
if (queryObject != null) {
|
if (queryObject != null) {
|
||||||
String id = !StringUtils.hasText(query.getId()) ? getPersistentEntityId(queryObject) : query.getId();
|
String id = StringUtils.hasText(query.getId()) ? query.getId() : getPersistentEntityId(queryObject);
|
||||||
builder //
|
builder //
|
||||||
.id(id) //
|
.id(id) //
|
||||||
.document(elasticsearchConverter.mapObject(queryObject));
|
.document(elasticsearchConverter.mapObject(queryObject));
|
||||||
@ -528,7 +512,7 @@ class RequestConverter {
|
|||||||
Object queryObject = query.getObject();
|
Object queryObject = query.getObject();
|
||||||
|
|
||||||
if (queryObject != null) {
|
if (queryObject != null) {
|
||||||
String id = StringUtils.hasText(query.getId()) ? getPersistentEntityId(queryObject) : query.getId();
|
String id = StringUtils.hasText(query.getId()) ? query.getId() : getPersistentEntityId(queryObject);
|
||||||
builder //
|
builder //
|
||||||
.id(id) //
|
.id(id) //
|
||||||
.document(elasticsearchConverter.mapObject(queryObject));
|
.document(elasticsearchConverter.mapObject(queryObject));
|
||||||
@ -569,7 +553,7 @@ class RequestConverter {
|
|||||||
Object queryObject = query.getObject();
|
Object queryObject = query.getObject();
|
||||||
|
|
||||||
if (queryObject != null) {
|
if (queryObject != null) {
|
||||||
String id = StringUtils.hasText(query.getId()) ? getPersistentEntityId(queryObject) : query.getId();
|
String id = StringUtils.hasText(query.getId()) ? query.getId() : getPersistentEntityId(queryObject);
|
||||||
builder //
|
builder //
|
||||||
.id(id) //
|
.id(id) //
|
||||||
.document(elasticsearchConverter.mapObject(queryObject));
|
.document(elasticsearchConverter.mapObject(queryObject));
|
||||||
@ -1162,11 +1146,9 @@ class RequestConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isEmpty(query.getIndicesBoost())) {
|
if (!isEmpty(query.getIndicesBoost())) {
|
||||||
Map<String, Double> boosts = new LinkedHashMap<>();
|
bb.indicesBoost(query.getIndicesBoost().stream()
|
||||||
query.getIndicesBoost()
|
.map(indexBoost -> Map.of(indexBoost.getIndexName(), Double.valueOf(indexBoost.getBoost())))
|
||||||
.forEach(indexBoost -> boosts.put(indexBoost.getIndexName(), (double) indexBoost.getBoost()));
|
.collect(Collectors.toList()));
|
||||||
// noinspection unchecked
|
|
||||||
bb.indicesBoost(boosts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query instanceof NativeQuery) {
|
if (query instanceof NativeQuery) {
|
||||||
@ -1317,11 +1299,9 @@ class RequestConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isEmpty(query.getIndicesBoost())) {
|
if (!isEmpty(query.getIndicesBoost())) {
|
||||||
Map<String, Double> boosts = new LinkedHashMap<>();
|
builder.indicesBoost(query.getIndicesBoost().stream()
|
||||||
query.getIndicesBoost()
|
.map(indexBoost -> Map.of(indexBoost.getIndexName(), Double.valueOf(indexBoost.getBoost())))
|
||||||
.forEach(indexBoost -> boosts.put(indexBoost.getIndexName(), (double) indexBoost.getBoost()));
|
.collect(Collectors.toList()));
|
||||||
// noinspection unchecked
|
|
||||||
builder.indicesBoost(boosts);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1389,9 +1369,10 @@ class RequestConverter {
|
|||||||
return SortOptions.of(so -> so //
|
return SortOptions.of(so -> so //
|
||||||
.geoDistance(gd -> gd //
|
.geoDistance(gd -> gd //
|
||||||
.field(fieldName) //
|
.field(fieldName) //
|
||||||
.location(loc -> loc.latlon(QueryBuilders.latLon(geoDistanceOrder.getGeoPoint())))//
|
.location(loc -> loc.latlon(QueryBuilders.latLon(geoDistanceOrder.getGeoPoint()))) //
|
||||||
.distanceType(TypeUtils.geoDistanceType(geoDistanceOrder.getDistanceType()))
|
.distanceType(TypeUtils.geoDistanceType(geoDistanceOrder.getDistanceType()))
|
||||||
.mode(TypeUtils.sortMode(finalMode)) //
|
.mode(TypeUtils.sortMode(finalMode)) //
|
||||||
|
.order(TypeUtils.sortOrder(geoDistanceOrder.getDirection())) //
|
||||||
.unit(TypeUtils.distanceUnit(geoDistanceOrder.getUnit())) //
|
.unit(TypeUtils.distanceUnit(geoDistanceOrder.getUnit())) //
|
||||||
.ignoreUnmapped(geoDistanceOrder.getIgnoreUnmapped())));
|
.ignoreUnmapped(geoDistanceOrder.getIgnoreUnmapped())));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -27,6 +27,7 @@ import co.elastic.clients.elasticsearch.core.search.ScoreMode;
|
|||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.elasticsearch.core.RefreshPolicy;
|
import org.springframework.data.elasticsearch.core.RefreshPolicy;
|
||||||
import org.springframework.data.elasticsearch.core.query.GeoDistanceOrder;
|
import org.springframework.data.elasticsearch.core.query.GeoDistanceOrder;
|
||||||
import org.springframework.data.elasticsearch.core.query.IndexQuery;
|
import org.springframework.data.elasticsearch.core.query.IndexQuery;
|
||||||
@ -136,6 +137,20 @@ final class TypeUtils {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
static SortOrder sortOrder(@Nullable Sort.Direction direction) {
|
||||||
|
|
||||||
|
if (direction == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return switch (direction) {
|
||||||
|
case ASC -> SortOrder.Asc;
|
||||||
|
case DESC -> SortOrder.Desc;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
static HighlighterFragmenter highlighterFragmenter(@Nullable String value) {
|
static HighlighterFragmenter highlighterFragmenter(@Nullable String value) {
|
||||||
|
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 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.aot;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.springframework.aot.hint.MemberCategory;
|
||||||
|
import org.springframework.aot.hint.RuntimeHints;
|
||||||
|
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||||
|
import org.springframework.aot.hint.TypeReference;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Peter-Josef Meisch
|
||||||
|
* @since 5.0.1
|
||||||
|
*/
|
||||||
|
public class ElasticsearchClientRuntimeHints implements RuntimeHintsRegistrar {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||||
|
// needed for the http client used by the Elasticsearch client
|
||||||
|
hints.serialization().registerType(org.apache.http.impl.auth.BasicScheme.class);
|
||||||
|
hints.serialization().registerType(org.apache.http.impl.auth.RFC2617Scheme.class);
|
||||||
|
hints.serialization().registerType(java.util.HashMap.class);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
@org.springframework.lang.NonNullApi
|
||||||
|
@org.springframework.lang.NonNullFields
|
||||||
|
package org.springframework.data.elasticsearch.client.elc.aot;
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022 the original author or authors.
|
* Copyright 2022-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2022 the original author or authors.
|
* Copyright 2018-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2022 the original author or authors.
|
* Copyright 2018-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2022 the original author or authors.
|
* Copyright 2013-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2022 the original author or authors.
|
* Copyright 2013-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2022 the original author or authors.
|
* Copyright 2021-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user