Compare commits
70 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 06d57b8a55 | |||
| 17cb07b0c0 | |||
| f29c836e33 | |||
| cea2c282fe | |||
| 38ba9fd08a | |||
| 473caa8214 | |||
| 33faaa8689 | |||
| 189611af7f | |||
| db2f779ff3 | |||
| 6654eaa38f | |||
| ebdc57e4b2 | |||
| 4cbfef39c6 | |||
| 8ad2e8e0a0 | |||
| 795e1ef60a | |||
| a08ffc85cf | |||
| c3eb590afe | |||
| fa065c1f27 | |||
| 5706fc0d3f | |||
| ad68771825 | |||
| eb5c6872d9 | |||
| 4ee59bb52f | |||
| ffdbea4dba | |||
| 7c1bc087ba | |||
| 475df8ef80 | |||
| 78bef3105c | |||
| 81d40611b9 | |||
| 446869154f | |||
| 836187c170 | |||
| 87427d96a2 | |||
| 4803ac2f98 | |||
| da059770ba | |||
| 36056d1b63 | |||
| 2c01e1ee1a | |||
| 9852589000 | |||
| 6e86bb2892 | |||
| d9a70f8fb1 | |||
| 56ff6fcce2 | |||
| 6f4a50c437 | |||
| f2d8c71e64 | |||
| 29997d114d | |||
| 2c77df67c3 | |||
| 672315475d | |||
| 0c1f5369df | |||
| 0d688ac728 | |||
| 0dddc9e952 | |||
| cf8d803877 | |||
| a994520a38 | |||
| 2952389f26 | |||
| 548841cc22 | |||
| 2278d075a7 | |||
| 9a66c77b06 | |||
| ead1926d13 | |||
| c5043d6544 | |||
| bccaa5c0ab | |||
| 0a65d36040 | |||
| f5e9558f3c | |||
| c118bb3b84 | |||
| a7871385bf | |||
| cf9de2fc7d | |||
| e0199e3ed4 | |||
| 1e5341ad07 | |||
| 6c7c323246 | |||
| d623f228a0 | |||
| 8c0e62c9d8 | |||
| 69746441e1 | |||
| e31b66768b | |||
| e7e0ac89e2 | |||
| 5821a81db9 | |||
| eabfd95497 | |||
| b712cb8829 |
@@ -0,0 +1,83 @@
|
|||||||
|
= Spring Data for Elasticsearch image:https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A["Revved up by Develocity", link="https://ge.spring.io/scans?search.rootProjectNames=Spring Data Elasticsearch"]
|
||||||
|
|
||||||
|
The primary goal of the https://projects.spring.io/spring-data[Spring Data] project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.
|
||||||
|
|
||||||
|
The Spring Data Elasticsearch project provides integration with the https://www.elastic.co/[Elasticsearch] search engine.
|
||||||
|
Key functional areas of Spring Data Elasticsearch are a POJO centric model for interacting with Elasticsearch Documents and easily writing a Repository style data access layer.
|
||||||
|
|
||||||
|
This project is lead and maintained by the community.
|
||||||
|
|
||||||
|
== Features
|
||||||
|
|
||||||
|
* Spring configuration support using Java based `@Configuration` classes or an XML namespace for an ES client instances.
|
||||||
|
* `ElasticsearchOperations` class and implementations that increases productivity performing common ES operations.
|
||||||
|
Includes integrated object mapping between documents and POJOs.
|
||||||
|
* Feature Rich Object Mapping integrated with Spring’s Conversion Service
|
||||||
|
* Annotation based mapping metadata
|
||||||
|
* Automatic implementation of `Repository` interfaces including support for custom search methods.
|
||||||
|
* CDI support for repositories
|
||||||
|
|
||||||
|
include::https://raw.githubusercontent.com/spring-projects/spring-data-build/refs/heads/main/etc/readme/code-of-conduct.adoc[]
|
||||||
|
|
||||||
|
== Getting Started
|
||||||
|
|
||||||
|
Here is a quick teaser of an application using Spring Data Repositories in Java:
|
||||||
|
|
||||||
|
[source,java]
|
||||||
|
----
|
||||||
|
public interface PersonRepository extends CrudRepository<Person, Long> {
|
||||||
|
|
||||||
|
List<Person> findByLastname(String lastname);
|
||||||
|
|
||||||
|
List<Person> findByFirstnameLike(String firstname);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MyService {
|
||||||
|
|
||||||
|
private final PersonRepository repository;
|
||||||
|
|
||||||
|
public MyService(PersonRepository repository) {
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doWork() {
|
||||||
|
|
||||||
|
repository.deleteAll();
|
||||||
|
|
||||||
|
Person person = new Person();
|
||||||
|
person.setFirstname("Oliver");
|
||||||
|
person.setLastname("Gierke");
|
||||||
|
repository.save(person);
|
||||||
|
|
||||||
|
List<Person> lastNameResults = repository.findByLastname("Gierke");
|
||||||
|
List<Person> firstNameResults = repository.findByFirstnameLike("Oli");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
----
|
||||||
|
|
||||||
|
=== Using the RestClient
|
||||||
|
|
||||||
|
Please check the https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#elasticsearch.clients.configuration[official documentation].
|
||||||
|
|
||||||
|
include::https://raw.githubusercontent.com/spring-projects/spring-data-build/refs/heads/main/etc/readme/dependencies.adoc[]
|
||||||
|
|
||||||
|
**Compatibility Matrix**
|
||||||
|
|
||||||
|
The compatibility between Spring Data Elasticsearch, Elasticsearch client drivers and Spring Boot versions can be found in the https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#preface.versions[reference documentation].
|
||||||
|
|
||||||
|
To use the Release candidate versions of the upcoming major version, use our Maven milestone repository and declare the appropriate dependency version:
|
||||||
|
|
||||||
|
[source,xml]
|
||||||
|
----
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.data</groupId>
|
||||||
|
<artifactId>spring-data-elasticsearch</artifactId>
|
||||||
|
<version>${version}.RCx</version> <!-- x being 1, 2, ... -->
|
||||||
|
</dependency>
|
||||||
|
----
|
||||||
|
|
||||||
|
include::https://raw.githubusercontent.com/spring-projects/spring-data-build/refs/heads/main/etc/readme/getting-help.adoc[]
|
||||||
|
|
||||||
|
include::https://raw.githubusercontent.com/spring-projects/spring-data-build/refs/heads/main/etc/readme/license.adoc[]
|
||||||
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
name: CI Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [ 6.1.x, 'issue/6.1.x/**' ]
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-java:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
java-version: [ base, main ]
|
||||||
|
name: Build project
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- name: Setup Java and Maven
|
||||||
|
uses: spring-projects/spring-data-build/actions/setup-maven@4.1.x
|
||||||
|
with:
|
||||||
|
java-version: ${{ matrix.java-version }}
|
||||||
|
develocity-access-key: '${{ secrets.DEVELOCITY_ACCESS_KEY }}'
|
||||||
|
- name: Build
|
||||||
|
uses: spring-projects/spring-data-build/actions/maven-build@4.1.x
|
||||||
|
env:
|
||||||
|
TESTCONTAINERS_REUSE_ENABLE: true
|
||||||
|
with:
|
||||||
|
settings-xml: '${{ vars.SETTINGS_XML }}'
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
# GitHub Actions to automate GitHub issues for Spring Data Project Management
|
|
||||||
|
|
||||||
name: Spring Data GitHub Issues
|
|
||||||
|
|
||||||
on:
|
|
||||||
issues:
|
|
||||||
types: [opened, edited, reopened]
|
|
||||||
issue_comment:
|
|
||||||
types: [created]
|
|
||||||
pull_request_target:
|
|
||||||
types: [opened, edited, reopened]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Inbox:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.repository_owner == 'spring-projects' && (github.event.action == 'opened' || github.event.action == 'reopened') && github.event.pull_request == null && !contains(join(github.event.issue.labels.*.name, ', '), 'dependency-upgrade') && !contains(github.event.issue.title, 'Release ')
|
|
||||||
steps:
|
|
||||||
- name: Create or Update Issue Card
|
|
||||||
uses: actions/add-to-project@v1.0.2
|
|
||||||
with:
|
|
||||||
project-url: https://github.com/orgs/spring-projects/projects/25
|
|
||||||
github-token: ${{ secrets.GH_ISSUES_TOKEN_SPRING_DATA }}
|
|
||||||
Pull-Request:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.repository_owner == 'spring-projects' && (github.event.action == 'opened' || github.event.action == 'reopened') && github.event.pull_request != null
|
|
||||||
steps:
|
|
||||||
- name: Create or Update Pull Request Card
|
|
||||||
uses: actions/add-to-project@v1.0.2
|
|
||||||
with:
|
|
||||||
project-url: https://github.com/orgs/spring-projects/projects/25
|
|
||||||
github-token: ${{ secrets.GH_ISSUES_TOKEN_SPRING_DATA }}
|
|
||||||
Feedback-Provided:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.repository_owner == 'spring-projects' && github.event_name == 'issue_comment' && github.event.action == 'created' && github.actor != 'spring-projects-issues' && github.event.pull_request == null && github.event.issue.state == 'open' && contains(toJSON(github.event.issue.labels), 'waiting-for-feedback')
|
|
||||||
steps:
|
|
||||||
- name: Update Project Card
|
|
||||||
uses: actions/add-to-project@v1.0.2
|
|
||||||
with:
|
|
||||||
project-url: https://github.com/orgs/spring-projects/projects/25
|
|
||||||
github-token: ${{ secrets.GH_ISSUES_TOKEN_SPRING_DATA }}
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
name: Snapshots
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [ 6.1.x, 'issue/6.1.x/**' ]
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-snapshots:
|
||||||
|
name: Build and deploy snapshots
|
||||||
|
if: ${{ github.repository_owner == 'spring-projects' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- name: Setup Java and Maven
|
||||||
|
uses: spring-projects/spring-data-build/actions/setup-maven@4.1.x
|
||||||
|
with:
|
||||||
|
develocity-access-key: '${{ secrets.DEVELOCITY_ACCESS_KEY }}'
|
||||||
|
- name: Deploy to Artifactory
|
||||||
|
uses: spring-projects/spring-data-build/actions/maven-artifactory-deploy@4.1.x
|
||||||
|
env:
|
||||||
|
TESTCONTAINERS_REUSE_ENABLE: true
|
||||||
|
with:
|
||||||
|
build-name: 'spring-data-elasticsearch'
|
||||||
|
username: '${{ secrets.ARTIFACTORY_USERNAME }}'
|
||||||
|
password: '${{ secrets.ARTIFACTORY_PASSWORD }}'
|
||||||
|
context-url: '${{ vars.ARTIFACTORY_CONTEXT_URL }}'
|
||||||
|
repository: '${{ vars.ARTIFACTORY_REPOSITORY }}'
|
||||||
|
project: '${{ vars.ARTIFACTORY_PROJECT }}'
|
||||||
|
settings-xml: '${{ vars.SETTINGS_XML }}'
|
||||||
+1
-1
@@ -3,6 +3,6 @@
|
|||||||
<extension>
|
<extension>
|
||||||
<groupId>io.spring.develocity.conventions</groupId>
|
<groupId>io.spring.develocity.conventions</groupId>
|
||||||
<artifactId>develocity-conventions-maven-extension</artifactId>
|
<artifactId>develocity-conventions-maven-extension</artifactId>
|
||||||
<version>0.0.22</version>
|
<version>0.0.25</version>
|
||||||
</extension>
|
</extension>
|
||||||
</extensions>
|
</extensions>
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
#Thu Jul 17 13:59:56 CEST 2025
|
#Tue Jun 02 14:58:35 CEST 2026
|
||||||
|
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.16/apache-maven-3.9.16-bin.zip
|
||||||
wrapperUrl=https\://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
wrapperUrl=https\://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
||||||
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip
|
|
||||||
|
|||||||
@@ -1,43 +1,5 @@
|
|||||||
= Continuous Integration
|
= Continuous Integration
|
||||||
|
|
||||||
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-elasticsearch%2Fmain&subject=2020.0.0%20(main)[link=https://jenkins.spring.io/view/SpringData/job/spring-data-elasticsearch/]
|
|
||||||
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-elasticsearch%2F4.0.x&subject=Neumann%20(4.0.x)[link=https://jenkins.spring.io/view/SpringData/job/spring-data-elasticsearch/]
|
|
||||||
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-elasticsearch%2F3.2.x&subject=Moore%20(3.2.x)[link=https://jenkins.spring.io/view/SpringData/job/spring-data-elasticsearch/]
|
|
||||||
|
|
||||||
== Running CI tasks locally
|
== Running CI tasks locally
|
||||||
|
|
||||||
Since this pipeline is purely Docker-based, it's easy to:
|
You can run CI jobs locally using Docker and act[https://nektosact.com/].
|
||||||
|
|
||||||
* Debug what went wrong on your local machine.
|
|
||||||
* Test out a a tweak to your `verify.sh` script before sending it out.
|
|
||||||
* Experiment against a new image before submitting your pull request.
|
|
||||||
|
|
||||||
All of these use cases are great reasons to essentially run what the CI server does on your local machine.
|
|
||||||
|
|
||||||
IMPORTANT: To do this you must have Docker installed on your machine.
|
|
||||||
|
|
||||||
1. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-data-elasticsearch-github adoptopenjdk/openjdk8:latest /bin/bash`
|
|
||||||
+
|
|
||||||
This will launch the Docker image and mount your source code at `spring-data-elasticsearch-github`.
|
|
||||||
+
|
|
||||||
2. `cd spring-data-elasticsearch-github`
|
|
||||||
+
|
|
||||||
Next, run your tests from inside the container:
|
|
||||||
+
|
|
||||||
3. `./mvnw clean dependency:list test -Dsort` (or whatever profile you need to test out)
|
|
||||||
|
|
||||||
Since the container is binding to your source, you can make edits from your IDE and continue to run build jobs.
|
|
||||||
|
|
||||||
If you need to package things up, do this:
|
|
||||||
|
|
||||||
1. `docker run -it -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source="$(pwd)",target=/spring-data-elasticsearch-github adoptopenjdk/openjdk8:latest /bin/bash`
|
|
||||||
+
|
|
||||||
This will launch the Docker image and mount your source code at `spring-data-elasticsearch-github`.
|
|
||||||
+
|
|
||||||
2. `cd spring-data-elasticsearch-github`
|
|
||||||
+
|
|
||||||
Next, try to package everything up from inside the container:
|
|
||||||
+
|
|
||||||
3. `./mvnw -Pci,snapshot -Dmaven.test.skip=true clean package`
|
|
||||||
|
|
||||||
NOTE: Docker containers can eat up disk space fast! From time to time, run `docker system prune` to clean out old images.
|
|
||||||
|
|||||||
Vendored
-132
@@ -1,132 +0,0 @@
|
|||||||
def p = [:]
|
|
||||||
node {
|
|
||||||
checkout scm
|
|
||||||
p = readProperties interpolate: true, file: 'ci/pipeline.properties'
|
|
||||||
}
|
|
||||||
|
|
||||||
pipeline {
|
|
||||||
agent none
|
|
||||||
|
|
||||||
triggers {
|
|
||||||
pollSCM 'H/10 * * * *'
|
|
||||||
upstream(upstreamProjects: "spring-data-commons/main", threshold: hudson.model.Result.SUCCESS)
|
|
||||||
}
|
|
||||||
|
|
||||||
options {
|
|
||||||
disableConcurrentBuilds()
|
|
||||||
buildDiscarder(logRotator(numToKeepStr: '14'))
|
|
||||||
}
|
|
||||||
|
|
||||||
stages {
|
|
||||||
stage("test: baseline (main)") {
|
|
||||||
when {
|
|
||||||
beforeAgent(true)
|
|
||||||
anyOf {
|
|
||||||
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
|
|
||||||
not { triggeredBy 'UpstreamCause' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
agent {
|
|
||||||
label 'data'
|
|
||||||
}
|
|
||||||
options { timeout(time: 30, unit: 'MINUTES') }
|
|
||||||
|
|
||||||
environment {
|
|
||||||
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
|
|
||||||
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
|
|
||||||
}
|
|
||||||
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
|
|
||||||
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
|
|
||||||
sh "PROFILE=none JENKINS_USER_NAME=${p['jenkins.user.name']} ci/verify.sh"
|
|
||||||
sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage("Test other configurations") {
|
|
||||||
when {
|
|
||||||
beforeAgent(true)
|
|
||||||
allOf {
|
|
||||||
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
|
|
||||||
not { triggeredBy 'UpstreamCause' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
parallel {
|
|
||||||
stage("test: baseline (next)") {
|
|
||||||
agent {
|
|
||||||
label 'data'
|
|
||||||
}
|
|
||||||
options { timeout(time: 30, unit: 'MINUTES') }
|
|
||||||
environment {
|
|
||||||
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
|
|
||||||
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
|
|
||||||
docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) {
|
|
||||||
sh "PROFILE=none JENKINS_USER_NAME=${p['jenkins.user.name']} ci/verify.sh"
|
|
||||||
sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Release to artifactory') {
|
|
||||||
when {
|
|
||||||
beforeAgent(true)
|
|
||||||
anyOf {
|
|
||||||
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP")
|
|
||||||
not { triggeredBy 'UpstreamCause' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
agent {
|
|
||||||
label 'data'
|
|
||||||
}
|
|
||||||
options { timeout(time: 20, unit: 'MINUTES') }
|
|
||||||
environment {
|
|
||||||
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
|
|
||||||
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
|
|
||||||
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
|
|
||||||
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
|
|
||||||
"./mvnw -s settings.xml -Pci,artifactory " +
|
|
||||||
"-Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root " +
|
|
||||||
"-Dartifactory.server=${p['artifactory.url']} " +
|
|
||||||
"-Dartifactory.username=${ARTIFACTORY_USR} " +
|
|
||||||
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
|
|
||||||
"-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " +
|
|
||||||
"-Dartifactory.build-name=spring-data-elasticsearch " +
|
|
||||||
"-Dartifactory.build-number=spring-data-elasticsearch-${BRANCH_NAME}-build-${BUILD_NUMBER} " +
|
|
||||||
"-Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch " +
|
|
||||||
"-Dmaven.test.skip=true clean deploy -U -B"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
changed {
|
|
||||||
script {
|
|
||||||
emailext(
|
|
||||||
subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}",
|
|
||||||
mimeType: 'text/html',
|
|
||||||
recipientProviders: [[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']],
|
|
||||||
body: "<a href=\"${env.BUILD_URL}\">${currentBuild.fullDisplayName} is reported as ${currentBuild.currentResult}</a>")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
= Spring Data for Elasticsearch image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-elasticsearch%2Fmain&subject=Build[link=https://jenkins.spring.io/view/SpringData/job/spring-data-elasticsearch/] https://gitter.im/spring-projects/spring-data[image:https://badges.gitter.im/spring-projects/spring-data.svg[Gitter]] image:https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A["Revved up by Develocity", link="https://ge.spring.io/scans?search.rootProjectNames=Spring Data Elasticsearch"]
|
= Spring Data for Elasticsearch image:https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A["Revved up by Develocity", link="https://ge.spring.io/scans?search.rootProjectNames=Spring Data Elasticsearch"]
|
||||||
|
|
||||||
The primary goal of the https://projects.spring.io/spring-data[Spring Data] project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.
|
The primary goal of the https://projects.spring.io/spring-data[Spring Data] project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash -x
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
export JENKINS_USER=${JENKINS_USER_NAME}
|
|
||||||
|
|
||||||
MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \
|
|
||||||
./mvnw -s settings.xml clean -Dscan=false -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
# Java versions
|
|
||||||
java.main.tag=25-jdk-noble
|
|
||||||
java.next.tag=25-jdk-noble
|
|
||||||
|
|
||||||
# Docker container images - standard
|
|
||||||
docker.java.main.image=library/eclipse-temurin:${java.main.tag}
|
|
||||||
docker.java.next.image=library/eclipse-temurin:${java.next.tag}
|
|
||||||
|
|
||||||
# Supported versions of MongoDB
|
|
||||||
docker.mongodb.6.0.version=6.0.23
|
|
||||||
docker.mongodb.7.0.version=7.0.20
|
|
||||||
docker.mongodb.8.0.version=8.0.9
|
|
||||||
|
|
||||||
# Supported versions of Redis
|
|
||||||
docker.redis.6.version=6.2.13
|
|
||||||
docker.redis.7.version=7.2.4
|
|
||||||
docker.valkey.8.version=8.1.1
|
|
||||||
|
|
||||||
# Docker environment settings
|
|
||||||
docker.java.inside.basic=-v $HOME:/tmp/jenkins-home
|
|
||||||
docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home
|
|
||||||
|
|
||||||
# Credentials
|
|
||||||
docker.registry=
|
|
||||||
docker.credentials=hub.docker.com-springbuildmaster
|
|
||||||
docker.proxy.registry=https://docker-hub.usw1.packages.broadcom.com
|
|
||||||
docker.proxy.credentials=usw1_packages_broadcom_com-jenkins-token
|
|
||||||
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c
|
|
||||||
artifactory.url=https://repo.spring.io
|
|
||||||
artifactory.repository.snapshot=libs-snapshot-local
|
|
||||||
develocity.access-key=gradle_enterprise_secret_access_key
|
|
||||||
jenkins.user.name=spring-builds+jenkins
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash -x
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
mkdir -p /tmp/jenkins-home/.m2/spring-data-elasticsearch
|
|
||||||
export JENKINS_USER=${JENKINS_USER_NAME}
|
|
||||||
|
|
||||||
MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \
|
|
||||||
./mvnw -s settings.xml \
|
|
||||||
-P${PROFILE} clean dependency:list verify -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-elasticsearch -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root
|
|
||||||
@@ -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>6.0.0</version>
|
<version>6.1.1-SNAPSHOT</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>4.0.0</version>
|
<version>4.1.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<name>Spring Data Elasticsearch</name>
|
<name>Spring Data Elasticsearch</name>
|
||||||
@@ -18,14 +18,14 @@
|
|||||||
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>
|
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<springdata.commons>4.0.0</springdata.commons>
|
<springdata.commons>4.1.1-SNAPSHOT</springdata.commons>
|
||||||
|
|
||||||
<!-- version of the ElasticsearchClient -->
|
<!-- version of the ElasticsearchClient -->
|
||||||
<elasticsearch-java>9.2.1</elasticsearch-java>
|
<elasticsearch-java>9.4.3</elasticsearch-java>
|
||||||
<elasticsearch-rest-client>9.2.1</elasticsearch-rest-client>
|
<elasticsearch-rest-client>9.4.3</elasticsearch-rest-client>
|
||||||
|
|
||||||
<hoverfly>0.20.2</hoverfly>
|
<hoverfly>0.20.2</hoverfly>
|
||||||
<log4j>2.25.1</log4j>
|
<log4j>2.25.4</log4j>
|
||||||
<jsonassert>1.5.3</jsonassert>
|
<jsonassert>1.5.3</jsonassert>
|
||||||
<wiremock>3.9.2</wiremock>
|
<wiremock>3.9.2</wiremock>
|
||||||
|
|
||||||
@@ -82,8 +82,7 @@
|
|||||||
<scm>
|
<scm>
|
||||||
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>
|
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>
|
||||||
<connection>scm:git:git://github.com/spring-projects/spring-data-elasticsearch.git</connection>
|
<connection>scm:git:git://github.com/spring-projects/spring-data-elasticsearch.git</connection>
|
||||||
<developerConnection>scm:git:ssh://git@github.com/spring-projects/spring-data-elasticsearch.git
|
<developerConnection>scm:git:ssh://git@github.com/spring-projects/spring-data-elasticsearch.git</developerConnection>
|
||||||
</developerConnection>
|
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<issueManagement>
|
<issueManagement>
|
||||||
@@ -91,6 +90,27 @@
|
|||||||
<url>https://github.com/spring-projects/spring-data-elasticsearch/issues</url>
|
<url>https://github.com/spring-projects/spring-data-elasticsearch/issues</url>
|
||||||
</issueManagement>
|
</issueManagement>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.19.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.20.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- Spring -->
|
<!-- Spring -->
|
||||||
@@ -158,17 +178,30 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Jackson JSON Mapper -->
|
<!-- Jackson JSON Mapper -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>tools.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>tools.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Version 2 to use with the legacy RestClient -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- CDI -->
|
<!-- CDI -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.interceptor</groupId>
|
<groupId>javax.interceptor</groupId>
|
||||||
<artifactId>javax.interceptor-api</artifactId>
|
<artifactId>javax.interceptor-api</artifactId>
|
||||||
@@ -301,21 +334,6 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Upgrade xbean to 4.5 to prevent incompatibilities due to ASM versions -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.xbean</groupId>
|
|
||||||
<artifactId>xbean-asm5-shaded</artifactId>
|
|
||||||
<version>4.5</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.servlet</groupId>
|
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
|
||||||
<version>3.1.0</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-junit-jupiter</artifactId>
|
<artifactId>mockito-junit-jupiter</artifactId>
|
||||||
@@ -323,27 +341,12 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
<version>3.19.0</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.testcontainers</groupId>
|
<groupId>org.testcontainers</groupId>
|
||||||
<artifactId>testcontainers-elasticsearch</artifactId>
|
<artifactId>testcontainers-elasticsearch</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--we need Murmur3Hash in a test, before 5.2 we had it from the old Elasticsearch dependency -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-codec</groupId>
|
|
||||||
<artifactId>commons-codec</artifactId>
|
|
||||||
<version>1.15</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tngtech.archunit</groupId>
|
<groupId>com.tngtech.archunit</groupId>
|
||||||
<artifactId>archunit-junit5</artifactId>
|
<artifactId>archunit-junit5</artifactId>
|
||||||
@@ -351,7 +354,13 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
<dependency>
|
||||||
|
<groupId>io.micrometer</groupId>
|
||||||
|
<artifactId>micrometer-observation-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
@@ -489,8 +498,20 @@
|
|||||||
</profiles>
|
</profiles>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spring-snapshot</id>
|
||||||
|
<url>https://repo.spring.io/snapshot</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
<releases>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</releases>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>spring-milestone</id>
|
||||||
|
<url>https://repo.spring.io/milestone</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
|
|
||||||
https://maven.apache.org/xsd/settings-1.0.0.xsd">
|
|
||||||
|
|
||||||
<servers>
|
|
||||||
<server>
|
|
||||||
<id>spring-plugins-release</id>
|
|
||||||
<username>${env.ARTIFACTORY_USR}</username>
|
|
||||||
<password>${env.ARTIFACTORY_PSW}</password>
|
|
||||||
</server>
|
|
||||||
<server>
|
|
||||||
<id>spring-libs-snapshot</id>
|
|
||||||
<username>${env.ARTIFACTORY_USR}</username>
|
|
||||||
<password>${env.ARTIFACTORY_PSW}</password>
|
|
||||||
</server>
|
|
||||||
<server>
|
|
||||||
<id>spring-libs-milestone</id>
|
|
||||||
<username>${env.ARTIFACTORY_USR}</username>
|
|
||||||
<password>${env.ARTIFACTORY_PSW}</password>
|
|
||||||
</server>
|
|
||||||
<server>
|
|
||||||
<id>spring-libs-release</id>
|
|
||||||
<username>${env.ARTIFACTORY_USR}</username>
|
|
||||||
<password>${env.ARTIFACTORY_PSW}</password>
|
|
||||||
</server>
|
|
||||||
</servers>
|
|
||||||
|
|
||||||
</settings>
|
|
||||||
@@ -6,12 +6,8 @@ nav:
|
|||||||
ext:
|
ext:
|
||||||
collector:
|
collector:
|
||||||
- run:
|
- run:
|
||||||
command: ./mvnw validate process-resources -am -Pantora-process-resources
|
command: ./mvnw -B validate process-resources dependency:unpack -am -Pantora-process-resources
|
||||||
local: true
|
local: true
|
||||||
scan:
|
scan:
|
||||||
dir: target/classes/
|
- dir: target/classes/
|
||||||
- run:
|
- dir: target/antora/
|
||||||
command: ./mvnw package -Pdistribute
|
|
||||||
local: true
|
|
||||||
scan:
|
|
||||||
dir: target/antora
|
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ To see what is actually sent to and received from the server `Request` / `Respon
|
|||||||
This can be enabled in the Elasticsearch client by setting the level of the `co.elastic.clients.transport.rest5_client.low_level.Request` package to "trace" (see
|
This can be enabled in the Elasticsearch client by setting the level of the `co.elastic.clients.transport.rest5_client.low_level.Request` package to "trace" (see
|
||||||
https://www.elastic.co/docs/reference/elasticsearch/clients/java/transport/rest5-client/usage/logging)
|
https://www.elastic.co/docs/reference/elasticsearch/clients/java/transport/rest5-client/usage/logging)
|
||||||
|
|
||||||
.Enable transport layer logging
|
.Enable transport layer logging
|
||||||
[tabs]
|
[tabs]
|
||||||
======
|
======
|
||||||
XML::
|
XML::
|
||||||
@@ -485,4 +485,4 @@ ini::
|
|||||||
----
|
----
|
||||||
logging.level.co.elastic.clients.transport.rest5_client.low_level.Request=trace
|
logging.level.co.elastic.clients.transport.rest5_client.low_level.Request=trace
|
||||||
----
|
----
|
||||||
=====
|
======
|
||||||
|
|||||||
@@ -1,6 +1,19 @@
|
|||||||
[[new-features]]
|
[[new-features]]
|
||||||
= What's new
|
= What's new
|
||||||
|
|
||||||
|
[[new-features.6-1-1]]
|
||||||
|
== New in Spring Data Elasticsearch 6.1.1
|
||||||
|
|
||||||
|
* Upgrade to Elasticsearch 9.4.3
|
||||||
|
|
||||||
|
[[new-features.6-1-0]]
|
||||||
|
== New in Spring Data Elasticsearch 6.1
|
||||||
|
|
||||||
|
* Upgrade to Elasticsearch 9.4.2
|
||||||
|
* Add support to use `IndexCoordinates` as repository query parameter
|
||||||
|
* Add support for includeNamedQueriesScore in Query
|
||||||
|
* Add support for Micrometer observation.
|
||||||
|
|
||||||
[[new-features.6-0-0]]
|
[[new-features.6-0-0]]
|
||||||
== New in Spring Data Elasticsearch 6.0
|
== New in Spring Data Elasticsearch 6.0
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,10 @@ The following table shows the Elasticsearch and Spring versions that are used by
|
|||||||
[cols="^,^,^,^",options="header"]
|
[cols="^,^,^,^",options="header"]
|
||||||
|===
|
|===
|
||||||
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework
|
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework
|
||||||
| 2025.1 | 6.0.x | 9.2.1 | 7.0.x
|
| 2026.0 | 6.1.x | 9.4.3 | 7.0.x
|
||||||
| 2025.0 | 5.5.x | 8.18.1 | 6.2.x
|
| 2025.1 | 6.0.x | 9.2.2 | 7.0.x
|
||||||
| 2024.1 | 5.4.xfootnote:oom[Out of maintenance] | 8.15.5 | 6.1.x
|
| 2025.0 | 5.5.xfootnote:oom[Out of maintenance] | 8.18.1 | 6.2.x
|
||||||
|
| 2024.1 | 5.4.xfootnote:oom[] | 8.15.5 | 6.1.x
|
||||||
| 2024.0 | 5.3.xfootnote:oom[] | 8.13.4 | 6.1.x
|
| 2024.0 | 5.3.xfootnote:oom[] | 8.13.4 | 6.1.x
|
||||||
| 2023.1 (Vaughan) | 5.2.xfootnote:oom[] | 8.11.1 | 6.1.x
|
| 2023.1 (Vaughan) | 5.2.xfootnote:oom[] | 8.11.1 | 6.1.x
|
||||||
| 2023.0 (Ullmann) | 5.1.xfootnote:oom[] | 8.7.1 | 6.0.x
|
| 2023.0 (Ullmann) | 5.1.xfootnote:oom[] | 8.7.1 | 6.0.x
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
[[elasticsearch.projections]]
|
[[elasticsearch.projections]]
|
||||||
= Projections
|
= Projections
|
||||||
|
|
||||||
|
[[elasticsearch.projections.limitations]]
|
||||||
|
== Spring Data Elasticsearch Projection Limitations
|
||||||
|
|
||||||
|
This chapter is pulled in from the Spring Data Commons documentation, but does not apply to Spring Data Elasticsearch.
|
||||||
|
|
||||||
|
IMPORTANT: Interface-based projections are not supported in Spring Data Elasticsearch repository query methods.
|
||||||
|
|
||||||
|
To limit the fields returned from Elasticsearch, use the xref:elasticsearch/repositories/elasticsearch-repositories.adoc#elasticsearch.repositories.annotations.sourcefilters[`@SourceFilters`] annotation on your repository methods instead.
|
||||||
|
|
||||||
include::{commons}@data-commons::page$repositories/projections.adoc[leveloffset=+1]
|
include::{commons}@data-commons::page$repositories/projections.adoc[leveloffset=+1]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ asciidoc:
|
|||||||
include-xml-namespaces: false
|
include-xml-namespaces: false
|
||||||
spring-data-commons-docs-url: '${documentation.baseurl}/spring-data/commons/reference/${springdata.commons.short}'
|
spring-data-commons-docs-url: '${documentation.baseurl}/spring-data/commons/reference/${springdata.commons.short}'
|
||||||
spring-data-commons-javadoc-base: '{spring-data-commons-docs-url}/api/java'
|
spring-data-commons-javadoc-base: '{spring-data-commons-docs-url}/api/java'
|
||||||
springdocsurl: '${documentation.baseurl}/spring-framework/reference/{springversionshort}'
|
springdocsurl: '${documentation.spring-reference-url}/{springversionshort}'
|
||||||
spring-framework-docs: '{springdocsurl}'
|
spring-framework-docs: '{springdocsurl}'
|
||||||
springjavadocurl: '${documentation.spring-javadoc-url}'
|
springjavadocurl: '${documentation.spring-javadoc-url}'
|
||||||
spring-framework-javadoc: '{springjavadocurl}'
|
spring-framework-javadoc: '{springjavadocurl}'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2025 the original author or authors.
|
* Copyright 2020-present 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.
|
||||||
@@ -15,10 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch;
|
package org.springframework.data.elasticsearch;
|
||||||
|
|
||||||
import org.springframework.dao.DataRetrievalFailureException;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
|
import org.springframework.dao.DataRetrievalFailureException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Peter-Josef Meisch
|
* @author Peter-Josef Meisch
|
||||||
* @author Illia Ulianov
|
* @author Illia Ulianov
|
||||||
@@ -42,6 +43,6 @@ public class BulkFailureException extends DataRetrievalFailureException {
|
|||||||
* @author Illia Ulianov
|
* @author Illia Ulianov
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
public record FailureDetails(Integer status, String errorMessage) {
|
public record FailureDetails(Integer status, @Nullable String errorMessage) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022-2025 the original author or authors.
|
* Copyright 2022-present 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.
|
||||||
@@ -28,7 +28,7 @@ import org.jspecify.annotations.Nullable;
|
|||||||
public class ElasticsearchErrorCause {
|
public class ElasticsearchErrorCause {
|
||||||
@Nullable private final String type;
|
@Nullable private final String type;
|
||||||
|
|
||||||
private final String reason;
|
@Nullable private final String reason;
|
||||||
|
|
||||||
@Nullable private final String stackTrace;
|
@Nullable private final String stackTrace;
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ public class ElasticsearchErrorCause {
|
|||||||
|
|
||||||
private final List<ElasticsearchErrorCause> suppressed;
|
private final List<ElasticsearchErrorCause> suppressed;
|
||||||
|
|
||||||
public ElasticsearchErrorCause(@Nullable String type, String reason, @Nullable String stackTrace,
|
public ElasticsearchErrorCause(@Nullable String type, @Nullable String reason, @Nullable String stackTrace,
|
||||||
@Nullable ElasticsearchErrorCause causedBy, List<ElasticsearchErrorCause> rootCause,
|
@Nullable ElasticsearchErrorCause causedBy, List<ElasticsearchErrorCause> rootCause,
|
||||||
List<ElasticsearchErrorCause> suppressed) {
|
List<ElasticsearchErrorCause> suppressed) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@@ -54,7 +54,7 @@ public class ElasticsearchErrorCause {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReason() {
|
public @Nullable String getReason() {
|
||||||
return reason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2025 the original author or authors.
|
* Copyright 2019-present 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-2025 the original author or authors.
|
* Copyright 2021-present 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-2025 the original author or authors.
|
* Copyright 2022-present 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-2025 the original author or authors.
|
* Copyright 2021-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2025 the original author or authors.
|
* Copyright 2020-present 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 2023-2025 the original author or authors.
|
* Copyright 2023-present 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 2024-2025 the original author or authors.
|
* Copyright 2024-present 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 2024-2025 the original author or authors.
|
* Copyright 2024-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019-2025 the original author or authors.
|
* Copyright 2019-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2025 the original author or authors.
|
* Copyright 2013-present 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-2025 the original author or authors.
|
* Copyright 2021-present 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-2025 the original author or authors.
|
* Copyright 2014-present 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-2025 the original author or authors.
|
* Copyright 2013-present 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-2025 the original author or authors.
|
* Copyright 2021-present 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-2025 the original author or authors.
|
* Copyright 2013-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2024-2025 the original author or authors.
|
* Copyright 2024-present 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-2025 the original author or authors.
|
* Copyright 2013-present 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 2024-2025 the original author or authors.
|
* Copyright 2024-present 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-2025 the original author or authors.
|
* Copyright 2013-present 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-2025 the original author or authors.
|
* Copyright 2017-present 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-2025 the original author or authors.
|
* Copyright 2020-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2025 the original author or authors.
|
* Copyright 2020-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2025 the original author or authors.
|
* Copyright 2020-present 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-2025 the original author or authors.
|
* Copyright 2019-present 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-2025 the original author or authors.
|
* Copyright 2019-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2023-2025 the original author or authors.
|
* Copyright 2023-present 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-2025 the original author or authors.
|
* Copyright 2014-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2025 the original author or authors.
|
* Copyright 2020-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2025 the original author or authors.
|
* Copyright 2020-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2024-2025 the original author or authors.
|
* Copyright 2024-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2024-2025 the original author or authors.
|
* Copyright 2024-present 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 2024-2025 the original author or authors.
|
* Copyright 2024-present 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-2025 the original author or authors.
|
* Copyright 2014-present 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 2024-2025 the original author or authors.
|
* Copyright 2024-present 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-2025 the original author or authors.
|
* Copyright 2014-present 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-2025 the original author or authors.
|
* Copyright 2020-present 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-2025 the original author or authors.
|
* Copyright 2013-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2025 the original author or authors.
|
* Copyright 2025-present 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-2025 the original author or authors.
|
* Copyright 2014-present 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-2025 the original author or authors.
|
* Copyright 2019-present 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-2025 the original author or authors.
|
* Copyright 2022-present 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-2025 the original author or authors.
|
* Copyright 2019-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 the original author or authors.
|
* Copyright 2021-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022-2025 the original author or authors.
|
* Copyright 2022-present 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-2025 the original author or authors.
|
* Copyright 2021-present 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,2 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022-present the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
@org.jspecify.annotations.NullMarked
|
@org.jspecify.annotations.NullMarked
|
||||||
package org.springframework.data.elasticsearch.annotations;
|
package org.springframework.data.elasticsearch.annotations;
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2023-2025 the original author or authors.
|
* Copyright 2023-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2023-2025 the original author or authors.
|
* Copyright 2023-present 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,2 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022-present the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
@org.jspecify.annotations.NullMarked
|
@org.jspecify.annotations.NullMarked
|
||||||
package org.springframework.data.elasticsearch.aot;
|
package org.springframework.data.elasticsearch.aot;
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2025 the original author or authors.
|
* Copyright 2018-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2025 the original author or authors.
|
* Copyright 2018-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2025 the original author or authors.
|
* Copyright 2018-present 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-2025 the original author or authors.
|
* Copyright 2018-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2025 the original author or authors.
|
* Copyright 2018-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2018-2025 the original author or authors.
|
* Copyright 2018-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022-2025 the original author or authors.
|
* Copyright 2022-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022-2025 the original author or authors.
|
* Copyright 2022-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2024-2025 the original author or authors.
|
* Copyright 2024-present 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-2025 the original author or authors.
|
* Copyright 2022-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 the original author or authors.
|
* Copyright 2021-present 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-2025 the original author or authors.
|
* Copyright 2021-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 the original author or authors.
|
* Copyright 2021-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 the original author or authors.
|
* Copyright 2021-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 the original author or authors.
|
* Copyright 2021-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 the original author or authors.
|
* Copyright 2021-present 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.
|
||||||
|
|||||||
+70
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2026-present the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.springframework.data.elasticsearch.client.elc;
|
||||||
|
|
||||||
|
import io.micrometer.common.KeyValues;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default {@link ElasticsearchObservationConvention} implementation.
|
||||||
|
*
|
||||||
|
* @author maryantocinn
|
||||||
|
* @since 6.1
|
||||||
|
*/
|
||||||
|
public class DefaultElasticsearchObservationConvention implements ElasticsearchObservationConvention {
|
||||||
|
|
||||||
|
public static final DefaultElasticsearchObservationConvention INSTANCE = new DefaultElasticsearchObservationConvention();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return ElasticsearchObservation.ELASTICSEARCH_COMMAND_OBSERVATION.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getContextualName(ElasticsearchObservationContext context) {
|
||||||
|
|
||||||
|
String indexName = context.getIndexName();
|
||||||
|
if (indexName != null) {
|
||||||
|
return context.getOperationName().getValue() + " " + indexName;
|
||||||
|
}
|
||||||
|
return context.getOperationName().getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyValues getLowCardinalityKeyValues(ElasticsearchObservationContext context) {
|
||||||
|
|
||||||
|
KeyValues keyValues = KeyValues.of(
|
||||||
|
ElasticsearchObservation.LowCardinalityKeyNames.OPERATION.withValue(context.getOperationName().getValue()));
|
||||||
|
|
||||||
|
String indexName = context.getIndexName();
|
||||||
|
if (indexName != null) {
|
||||||
|
keyValues = keyValues.and(ElasticsearchObservation.LowCardinalityKeyNames.COLLECTION.withValue(indexName));
|
||||||
|
}
|
||||||
|
|
||||||
|
return keyValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyValues getHighCardinalityKeyValues(ElasticsearchObservationContext context) {
|
||||||
|
|
||||||
|
Integer batchSize = context.getBatchSize();
|
||||||
|
if (batchSize != null) {
|
||||||
|
return KeyValues.of(
|
||||||
|
ElasticsearchObservation.HighCardinalityKeyNames.BATCH_SIZE.withValue(String.valueOf(batchSize)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return KeyValues.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
+155
-155
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 the original author or authors.
|
* Copyright 2021-present 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.
|
||||||
@@ -24,6 +24,14 @@ import co.elastic.clients.elasticsearch.core.search.Hit;
|
|||||||
import co.elastic.clients.elasticsearch.core.search.NestedIdentity;
|
import co.elastic.clients.elasticsearch.core.search.NestedIdentity;
|
||||||
import co.elastic.clients.json.JsonData;
|
import co.elastic.clients.json.JsonData;
|
||||||
import co.elastic.clients.json.JsonpMapper;
|
import co.elastic.clients.json.JsonpMapper;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.jspecify.annotations.Nullable;
|
import org.jspecify.annotations.Nullable;
|
||||||
@@ -36,13 +44,6 @@ import org.springframework.data.elasticsearch.core.document.SearchDocumentAdapte
|
|||||||
import org.springframework.data.elasticsearch.core.document.SearchDocumentResponse;
|
import org.springframework.data.elasticsearch.core.document.SearchDocumentResponse;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class to adapt different Elasticsearch responses to a
|
* Utility class to adapt different Elasticsearch responses to a
|
||||||
* {@link org.springframework.data.elasticsearch.core.document.Document}
|
* {@link org.springframework.data.elasticsearch.core.document.Document}
|
||||||
@@ -54,188 +55,187 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
final class DocumentAdapters {
|
final class DocumentAdapters {
|
||||||
|
|
||||||
private static final Log LOGGER = LogFactory.getLog(DocumentAdapters.class);
|
private static final Log LOGGER = LogFactory.getLog(DocumentAdapters.class);
|
||||||
|
|
||||||
private DocumentAdapters() {
|
private DocumentAdapters() {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link SearchDocument} from a {@link Hit} returned by the Elasticsearch client.
|
* Creates a {@link SearchDocument} from a {@link Hit} returned by the Elasticsearch client.
|
||||||
*
|
*
|
||||||
* @param hit the hit object
|
* @param hit the hit object
|
||||||
* @param jsonpMapper to map JsonData objects
|
* @param jsonpMapper to map JsonData objects
|
||||||
* @return the created {@link SearchDocument}
|
* @return the created {@link SearchDocument}
|
||||||
*/
|
*/
|
||||||
public static SearchDocument from(Hit<?> hit, JsonpMapper jsonpMapper) {
|
public static SearchDocument from(Hit<?> hit, JsonpMapper jsonpMapper) {
|
||||||
|
|
||||||
Assert.notNull(hit, "hit must not be null");
|
Assert.notNull(hit, "hit must not be null");
|
||||||
|
|
||||||
Map<String, List<String>> highlightFields = hit.highlight();
|
Map<String, List<String>> highlightFields = hit.highlight();
|
||||||
|
|
||||||
Map<String, SearchDocumentResponse> innerHits = new LinkedHashMap<>();
|
Map<String, SearchDocumentResponse> innerHits = new LinkedHashMap<>();
|
||||||
hit.innerHits().forEach((name, innerHitsResult) -> {
|
hit.innerHits().forEach((name, innerHitsResult) -> {
|
||||||
// noinspection ReturnOfNull
|
// noinspection ReturnOfNull
|
||||||
innerHits.put(name, SearchDocumentResponseBuilder.from(innerHitsResult.hits(), null, null, null, 0, null, null,
|
innerHits.put(name, SearchDocumentResponseBuilder.from(innerHitsResult.hits(), null, null, null, 0, null, null,
|
||||||
searchDocument -> null, jsonpMapper));
|
searchDocument -> null, jsonpMapper));
|
||||||
});
|
});
|
||||||
|
|
||||||
NestedMetaData nestedMetaData = from(hit.nested());
|
NestedMetaData nestedMetaData = from(hit.nested());
|
||||||
|
|
||||||
Explanation explanation = from(hit.explanation());
|
Explanation explanation = from(hit.explanation());
|
||||||
|
|
||||||
Map<String, Double> matchedQueries = hit.matchedQueries();
|
Map<String, Double> matchedQueries = hit.matchedQueries();
|
||||||
|
|
||||||
Function<Map<String, JsonData>, EntityAsMap> fromFields = fields -> {
|
Function<Map<String, JsonData>, EntityAsMap> fromFields = fields -> {
|
||||||
StringBuilder sb = new StringBuilder("{");
|
StringBuilder sb = new StringBuilder("{");
|
||||||
final boolean[] firstField = {true};
|
final boolean[] firstField = { true };
|
||||||
hit.fields().forEach((key, jsonData) -> {
|
hit.fields().forEach((key, jsonData) -> {
|
||||||
if (!firstField[0]) {
|
if (!firstField[0]) {
|
||||||
sb.append(',');
|
sb.append(',');
|
||||||
}
|
}
|
||||||
sb.append('"').append(key).append("\":") //
|
sb.append('"').append(key).append("\":") //
|
||||||
.append(jsonData.toJson(jsonpMapper).toString());
|
.append(jsonData.toJson(jsonpMapper).toString());
|
||||||
firstField[0] = false;
|
firstField[0] = false;
|
||||||
});
|
});
|
||||||
sb.append('}');
|
sb.append('}');
|
||||||
return new EntityAsMap().fromJson(sb.toString());
|
return new EntityAsMap().fromJson(sb.toString());
|
||||||
};
|
};
|
||||||
|
|
||||||
EntityAsMap hitFieldsAsMap = fromFields.apply(hit.fields());
|
EntityAsMap hitFieldsAsMap = fromFields.apply(hit.fields());
|
||||||
|
|
||||||
Map<String, List<Object>> documentFields = new LinkedHashMap<>();
|
Map<String, List<@Nullable Object>> documentFields = new LinkedHashMap<>();
|
||||||
hitFieldsAsMap.forEach((key, value) -> {
|
hitFieldsAsMap.forEach((key, value) -> {
|
||||||
if (value instanceof List) {
|
if (value instanceof List) {
|
||||||
// noinspection unchecked
|
// noinspection unchecked
|
||||||
documentFields.put(key, (List<Object>) value);
|
documentFields.put(key, (List<Object>) value);
|
||||||
} else {
|
} else {
|
||||||
documentFields.put(key, Collections.singletonList(value));
|
documentFields.put(key, Collections.singletonList(value));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Document document;
|
Document document;
|
||||||
Object source = hit.source();
|
Object source = hit.source();
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
document = Document.from(hitFieldsAsMap);
|
document = Document.from(hitFieldsAsMap);
|
||||||
} else {
|
} else {
|
||||||
if (source instanceof EntityAsMap entityAsMap) {
|
if (source instanceof EntityAsMap entityAsMap) {
|
||||||
document = Document.from(entityAsMap);
|
document = Document.from(entityAsMap);
|
||||||
} else if (source instanceof JsonData jsonData) {
|
} else if (source instanceof JsonData jsonData) {
|
||||||
document = Document.from(jsonData.to(EntityAsMap.class));
|
document = Document.from(jsonData.to(EntityAsMap.class));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (LOGGER.isWarnEnabled()) {
|
if (LOGGER.isWarnEnabled()) {
|
||||||
LOGGER.warn(String.format("Cannot map from type " + source.getClass().getName()));
|
LOGGER.warn(String.format("Cannot map from type " + source.getClass().getName()));
|
||||||
}
|
}
|
||||||
document = Document.create();
|
document = Document.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.setIndex(hit.index());
|
document.setIndex(hit.index());
|
||||||
document.setId(hit.id());
|
document.setId(hit.id());
|
||||||
|
|
||||||
if (hit.version() != null) {
|
if (hit.version() != null) {
|
||||||
document.setVersion(hit.version());
|
document.setVersion(hit.version());
|
||||||
}
|
}
|
||||||
document.setSeqNo(hit.seqNo() != null && hit.seqNo() >= 0 ? hit.seqNo() : -2); // -2 was the default value in the
|
document.setSeqNo(hit.seqNo() != null && hit.seqNo() >= 0 ? hit.seqNo() : -2); // -2 was the default value in the
|
||||||
// old client
|
// old client
|
||||||
document.setPrimaryTerm(hit.primaryTerm() != null && hit.primaryTerm() > 0 ? hit.primaryTerm() : 0);
|
document.setPrimaryTerm(hit.primaryTerm() != null && hit.primaryTerm() > 0 ? hit.primaryTerm() : 0);
|
||||||
|
|
||||||
float score = hit.score() != null ? hit.score().floatValue() : Float.NaN;
|
float score = hit.score() != null ? hit.score().floatValue() : Float.NaN;
|
||||||
return new SearchDocumentAdapter(document, score, hit.sort().stream().map(TypeUtils::toObject).toArray(),
|
return new SearchDocumentAdapter(document, score, hit.sort().stream().map(TypeUtils::toObject).toArray(),
|
||||||
documentFields, highlightFields, innerHits, nestedMetaData, explanation, matchedQueries, hit.routing());
|
documentFields, highlightFields, innerHits, nestedMetaData, explanation, matchedQueries, hit.routing());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchDocument from(CompletionSuggestOption<EntityAsMap> completionSuggestOption) {
|
public static SearchDocument from(CompletionSuggestOption<EntityAsMap> completionSuggestOption) {
|
||||||
|
|
||||||
Document document = completionSuggestOption.source() != null ? Document.from(completionSuggestOption.source())
|
Document document = completionSuggestOption.source() != null ? Document.from(completionSuggestOption.source())
|
||||||
: Document.create();
|
: Document.create();
|
||||||
document.setIndex(completionSuggestOption.index());
|
document.setIndex(completionSuggestOption.index());
|
||||||
|
|
||||||
if (completionSuggestOption.id() != null) {
|
if (completionSuggestOption.id() != null) {
|
||||||
document.setId(completionSuggestOption.id());
|
document.setId(completionSuggestOption.id());
|
||||||
}
|
}
|
||||||
|
|
||||||
float score = completionSuggestOption.score() != null ? completionSuggestOption.score().floatValue() : Float.NaN;
|
float score = completionSuggestOption.score() != null ? completionSuggestOption.score().floatValue() : Float.NaN;
|
||||||
return new SearchDocumentAdapter(document, score, new Object[]{}, Collections.emptyMap(), Collections.emptyMap(),
|
return new SearchDocumentAdapter(document, score, new Object[] {}, Collections.emptyMap(), Collections.emptyMap(),
|
||||||
Collections.emptyMap(), null, null, null, completionSuggestOption.routing());
|
Collections.emptyMap(), null, null, null, completionSuggestOption.routing());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private static Explanation from(co.elastic.clients.elasticsearch.core.explain.@Nullable Explanation explanation) {
|
private static Explanation from(co.elastic.clients.elasticsearch.core.explain.@Nullable Explanation explanation) {
|
||||||
|
|
||||||
if (explanation == null) {
|
if (explanation == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<Explanation> details = explanation.details().stream().map(DocumentAdapters::from).collect(Collectors.toList());
|
List<Explanation> details = explanation.details().stream().map(DocumentAdapters::from).collect(Collectors.toList());
|
||||||
return new Explanation(true, (double) explanation.value(), explanation.description(), details);
|
return new Explanation(true, (double) explanation.value(), explanation.description(), details);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Explanation from(ExplanationDetail explanationDetail) {
|
private static Explanation from(ExplanationDetail explanationDetail) {
|
||||||
|
|
||||||
List<Explanation> details = explanationDetail.details().stream().map(DocumentAdapters::from)
|
List<Explanation> details = explanationDetail.details().stream().map(DocumentAdapters::from)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
return new Explanation(null, (double) explanationDetail.value(), explanationDetail.description(), details);
|
return new Explanation(null, (double) explanationDetail.value(), explanationDetail.description(), details);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private static NestedMetaData from(@Nullable NestedIdentity nestedIdentity) {
|
private static NestedMetaData from(@Nullable NestedIdentity nestedIdentity) {
|
||||||
|
|
||||||
if (nestedIdentity == null) {
|
if (nestedIdentity == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
NestedMetaData child = from(nestedIdentity.nested());
|
NestedMetaData child = from(nestedIdentity.nested());
|
||||||
return NestedMetaData.of(nestedIdentity.field(), nestedIdentity.offset(), child);
|
return NestedMetaData.of(nestedIdentity.field(), nestedIdentity.offset(), child);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link Document} from a {@link GetResponse} where the found document is contained as {@link EntityAsMap}.
|
* Creates a {@link Document} from a {@link GetResponse} where the found document is contained as {@link EntityAsMap}.
|
||||||
*
|
*
|
||||||
* @param getResponse the response instance
|
* @param getResponse the response instance
|
||||||
* @return the Document
|
* @return the Document
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public static Document from(GetResult<EntityAsMap> getResponse) {
|
public static Document from(GetResult<EntityAsMap> getResponse) {
|
||||||
|
|
||||||
Assert.notNull(getResponse, "getResponse must not be null");
|
Assert.notNull(getResponse, "getResponse must not be null");
|
||||||
|
|
||||||
if (!getResponse.found()) {
|
if (!getResponse.found()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Document document = getResponse.source() != null ? Document.from(getResponse.source()) : Document.create();
|
Document document = getResponse.source() != null ? Document.from(getResponse.source()) : Document.create();
|
||||||
document.setIndex(getResponse.index());
|
document.setIndex(getResponse.index());
|
||||||
document.setId(getResponse.id());
|
document.setId(getResponse.id());
|
||||||
|
|
||||||
if (getResponse.version() != null) {
|
if (getResponse.version() != null) {
|
||||||
document.setVersion(getResponse.version());
|
document.setVersion(getResponse.version());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getResponse.seqNo() != null) {
|
if (getResponse.seqNo() != null) {
|
||||||
document.setSeqNo(getResponse.seqNo());
|
document.setSeqNo(getResponse.seqNo());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getResponse.primaryTerm() != null) {
|
if (getResponse.primaryTerm() != null) {
|
||||||
document.setPrimaryTerm(getResponse.primaryTerm());
|
document.setPrimaryTerm(getResponse.primaryTerm());
|
||||||
}
|
}
|
||||||
|
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a list of {@link MultiGetItem}s from a {@link MgetResponse} where the data is contained as
|
* Creates a list of {@link MultiGetItem}s from a {@link MgetResponse} where the data is contained as
|
||||||
* {@link EntityAsMap} instances.
|
* {@link EntityAsMap} instances.
|
||||||
*
|
*
|
||||||
* @param mgetResponse the response instance
|
* @param mgetResponse the response instance
|
||||||
* @return list of multiget items
|
* @return list of multiget items
|
||||||
*/
|
*/
|
||||||
public static List<MultiGetItem<Document>> from(MgetResponse<EntityAsMap> mgetResponse) {
|
public static List<MultiGetItem<Document>> from(MgetResponse<EntityAsMap> mgetResponse) {
|
||||||
|
|
||||||
Assert.notNull(mgetResponse, "mgetResponse must not be null");
|
Assert.notNull(mgetResponse, "mgetResponse must not be null");
|
||||||
|
|
||||||
return mgetResponse.docs().stream() //
|
return mgetResponse.docs().stream() //
|
||||||
.map(itemResponse -> MultiGetItem.of( //
|
.map(itemResponse -> MultiGetItem.of( //
|
||||||
itemResponse.isFailure() ? null : from(itemResponse.result()), //
|
itemResponse.isFailure() ? null : from(itemResponse.result()), //
|
||||||
ResponseConverter.getFailure(itemResponse)))
|
ResponseConverter.getFailure(itemResponse)))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022-2025 the original author or authors.
|
* Copyright 2022-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 the original author or authors.
|
* Copyright 2021-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022-2025 the original author or authors.
|
* Copyright 2022-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2022-2025 the original author or authors.
|
* Copyright 2022-present 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
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 the original author or authors.
|
* Copyright 2021-present 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.
|
||||||
|
|||||||
+9
-10
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 the original author or authors.
|
* Copyright 2021-present 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.
|
||||||
@@ -17,12 +17,14 @@ package org.springframework.data.elasticsearch.client.elc;
|
|||||||
|
|
||||||
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||||
import co.elastic.clients.json.JsonpMapper;
|
import co.elastic.clients.json.JsonpMapper;
|
||||||
import co.elastic.clients.json.jackson.JacksonJsonpMapper;
|
import co.elastic.clients.json.jackson.Jackson3JsonpMapper;
|
||||||
import co.elastic.clients.transport.ElasticsearchTransport;
|
import co.elastic.clients.transport.ElasticsearchTransport;
|
||||||
import co.elastic.clients.transport.TransportOptions;
|
import co.elastic.clients.transport.TransportOptions;
|
||||||
import co.elastic.clients.transport.rest5_client.Rest5ClientOptions;
|
import co.elastic.clients.transport.rest5_client.Rest5ClientOptions;
|
||||||
import co.elastic.clients.transport.rest5_client.low_level.RequestOptions;
|
import co.elastic.clients.transport.rest5_client.low_level.RequestOptions;
|
||||||
import co.elastic.clients.transport.rest5_client.low_level.Rest5Client;
|
import co.elastic.clients.transport.rest5_client.low_level.Rest5Client;
|
||||||
|
import tools.jackson.databind.cfg.JsonNodeFeature;
|
||||||
|
import tools.jackson.databind.json.JsonMapper;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.data.elasticsearch.client.ClientConfiguration;
|
import org.springframework.data.elasticsearch.client.ClientConfiguration;
|
||||||
@@ -32,10 +34,6 @@ import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
|||||||
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
|
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
|
||||||
import org.springframework.util.Assert;
|
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
|
* 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
|
* connection using the Elasticsearch Client. This class exposes different parts of the setup as Spring beans. Deriving
|
||||||
@@ -128,10 +126,11 @@ public abstract class ElasticsearchConfiguration extends ElasticsearchConfigurat
|
|||||||
// we need to create our own objectMapper that keeps null values in order to provide the storeNullValue
|
// 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
|
// 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.
|
// into this mapper, so we can safely keep them here.
|
||||||
var objectMapper = (new ObjectMapper())
|
JsonMapper jsonMapper = JsonMapper.builder()
|
||||||
.configure(SerializationFeature.INDENT_OUTPUT, false)
|
.enable(JsonNodeFeature.WRITE_NULL_PROPERTIES)
|
||||||
.setSerializationInclusion(JsonInclude.Include.ALWAYS);
|
.enable(JsonNodeFeature.READ_NULL_PROPERTIES)
|
||||||
return new JacksonJsonpMapper(objectMapper);
|
.build();
|
||||||
|
return new Jackson3JsonpMapper(jsonMapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 the original author or authors.
|
* Copyright 2021-present 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.
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2021-2025 the original author or authors.
|
* Copyright 2021-present 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.
|
||||||
@@ -47,7 +47,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
|||||||
* @since 4.4
|
* @since 4.4
|
||||||
* @deprecated since 6.0, use {@link ElasticsearchConfiguration}
|
* @deprecated since 6.0, use {@link ElasticsearchConfiguration}
|
||||||
*/
|
*/
|
||||||
@Deprecated(since = "6.0", forRemoval=true)
|
@Deprecated(since = "6.0", forRemoval = true)
|
||||||
public abstract class ElasticsearchLegacyRestClientConfiguration extends ElasticsearchConfigurationSupport {
|
public abstract class ElasticsearchLegacyRestClientConfiguration extends ElasticsearchConfigurationSupport {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+99
@@ -0,0 +1,99 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2026-present the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.springframework.data.elasticsearch.client.elc;
|
||||||
|
|
||||||
|
import io.micrometer.common.docs.KeyName;
|
||||||
|
import io.micrometer.observation.Observation;
|
||||||
|
import io.micrometer.observation.ObservationConvention;
|
||||||
|
import io.micrometer.observation.docs.ObservationDocumentation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link ObservationDocumentation} for Spring Data Elasticsearch template operations.
|
||||||
|
*
|
||||||
|
* @author maryantocinn
|
||||||
|
* @since 6.1
|
||||||
|
*/
|
||||||
|
public enum ElasticsearchObservation implements ObservationDocumentation {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timer created around a Spring Data Elasticsearch template operation.
|
||||||
|
*/
|
||||||
|
ELASTICSEARCH_COMMAND_OBSERVATION {
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "spring.data.elasticsearch.command";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends ObservationConvention<? extends Observation.Context>> getDefaultConvention() {
|
||||||
|
return DefaultElasticsearchObservationConvention.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyName[] getLowCardinalityKeyNames() {
|
||||||
|
return LowCardinalityKeyNames.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyName[] getHighCardinalityKeyNames() {
|
||||||
|
return HighCardinalityKeyNames.values();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Low cardinality key names for Spring Data Elasticsearch observations. These become metric dimensions and MUST be
|
||||||
|
* present on every observation to satisfy backends like Prometheus that require consistent tag key sets.
|
||||||
|
*/
|
||||||
|
enum LowCardinalityKeyNames implements KeyName {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Spring Data operation being performed (e.g., save, search, delete, bulk).
|
||||||
|
*/
|
||||||
|
OPERATION {
|
||||||
|
@Override
|
||||||
|
public String asString() {
|
||||||
|
return "spring.data.operation";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The target collection (index) name. Only present when the operation targets a specific index.
|
||||||
|
*/
|
||||||
|
COLLECTION {
|
||||||
|
@Override
|
||||||
|
public String asString() {
|
||||||
|
return "spring.data.collection";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* High cardinality key names for Spring Data Elasticsearch observations. These appear only on traces/spans, not on
|
||||||
|
* metrics, because their values are unbounded or optional per operation.
|
||||||
|
*/
|
||||||
|
enum HighCardinalityKeyNames implements KeyName {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of operations included in a batch (bulk) request. Only present for bulk operations.
|
||||||
|
*/
|
||||||
|
BATCH_SIZE {
|
||||||
|
@Override
|
||||||
|
public String asString() {
|
||||||
|
return "spring.data.batch.size";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+81
@@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2026-present the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.springframework.data.elasticsearch.client.elc;
|
||||||
|
|
||||||
|
import io.micrometer.observation.Observation;
|
||||||
|
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
|
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link Observation.Context} for Spring Data Elasticsearch operations. One instance is created per observed operation.
|
||||||
|
* It carries contextual data that conventions use to produce observation names and key-values.
|
||||||
|
*
|
||||||
|
* @author maryantocinn
|
||||||
|
* @since 6.1
|
||||||
|
*/
|
||||||
|
public class ElasticsearchObservationContext extends Observation.Context {
|
||||||
|
|
||||||
|
private final ElasticsearchOperationName operationName;
|
||||||
|
@Nullable private final IndexCoordinates indexCoordinates;
|
||||||
|
@Nullable private Integer batchSize;
|
||||||
|
|
||||||
|
public ElasticsearchObservationContext(ElasticsearchOperationName operationName,
|
||||||
|
@Nullable IndexCoordinates indexCoordinates) {
|
||||||
|
this.operationName = operationName;
|
||||||
|
this.indexCoordinates = indexCoordinates;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the Spring Data operation being performed.
|
||||||
|
*/
|
||||||
|
public ElasticsearchOperationName getOperationName() {
|
||||||
|
return operationName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the target index coordinates, or {@literal null} if the operation is not index-specific.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public IndexCoordinates getIndexCoordinates() {
|
||||||
|
return indexCoordinates;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the comma-joined index name(s), or {@literal null} if no index coordinates are set.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public String getIndexName() {
|
||||||
|
return indexCoordinates != null ? String.join(",", indexCoordinates.getIndexNames()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the batch size, or {@literal null} if not a batch operation.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public Integer getBatchSize() {
|
||||||
|
return batchSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of operations included in a batch (bulk) request.
|
||||||
|
*
|
||||||
|
* @param batchSize the batch size, can be {@literal null}
|
||||||
|
*/
|
||||||
|
public void setBatchSize(@Nullable Integer batchSize) {
|
||||||
|
this.batchSize = batchSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2026-present the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.springframework.data.elasticsearch.client.elc;
|
||||||
|
|
||||||
|
import io.micrometer.observation.Observation;
|
||||||
|
import io.micrometer.observation.ObservationConvention;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link ObservationConvention} for Spring Data Elasticsearch operations. Implement this interface and register it as a
|
||||||
|
* bean to customize observation names and key-values.
|
||||||
|
*
|
||||||
|
* @author maryantocinn
|
||||||
|
* @since 6.1
|
||||||
|
*/
|
||||||
|
public interface ElasticsearchObservationConvention extends ObservationConvention<ElasticsearchObservationContext> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default boolean supportsContext(Observation.Context context) {
|
||||||
|
return context instanceof ElasticsearchObservationContext;
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user