Skip to content

Commit c5262cb

Browse files
committed
Upate to Spring Data Elasticsearch 5.5
Signed-off-by: Andriy Redko <[email protected]>
1 parent b249b3a commit c5262cb

File tree

7 files changed

+18
-33
lines changed

7 files changed

+18
-33
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The Spring Data OpenSearch follows the release model of the Spring Data Elastics
2424

2525
| Spring Data Release Train | Spring Data OpenSearch | Spring Data Elasticsearch | OpenSearch Server | OpenSearch Client | Spring Framework | Spring Boot |
2626
|---------------------------|------------------------|---------------------------|-------------------|-------------------|------------------|---------------|
27+
| 2025.0 | 1.7.x | 5.5.x | 1.x / 2.x | 2.10.x and above | 6.2.x | 3.4.x |
2728
| 2024.1 | 1.6.x | 5.4.x | 1.x / 2.x | 2.10.x and above | 6.2.x | 3.4.x |
2829
| 2024.0 | 1.5.x | 5.3.x | 1.x / 2.x | 2.10.x and above | 6.1.x | 3.2.x / 3.3.x |
2930
| 2023.1 (Vaughan) | 1.4.x | 5.2.x | 1.x / 2.x | 2.10.x and above | 6.1.x | 3.2.x |

settings.gradle.kts

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ dependencyResolutionManagement {
1818
create("springLibs") {
1919
version("spring", "6.2.3")
2020
version("spring-boot", "3.4.3")
21-
library("data-commons", "org.springframework.data:spring-data-commons:3.4.3")
22-
library("data-elasticsearch", "org.springframework.data:spring-data-elasticsearch:5.4.3")
21+
library("data-commons", "org.springframework.data:spring-data-commons:3.5.0-M2")
22+
library("data-elasticsearch", "org.springframework.data:spring-data-elasticsearch:5.5.0-M2")
2323
library("web", "org.springframework", "spring-web").versionRef("spring")
2424
library("context", "org.springframework", "spring-context").versionRef("spring")
2525
library("tx", "org.springframework", "spring-tx").versionRef("spring")
@@ -80,6 +80,9 @@ pluginManagement {
8080
dependencyResolutionManagement {
8181
repositories {
8282
mavenCentral()
83+
maven {
84+
url = uri("https://repo.spring.io/milestone/")
85+
}
8386
}
8487
}
8588

spring-data-opensearch/src/main/java/org/opensearch/data/client/orhlc/OpenSearchRestTemplate.java

-8
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,6 @@ protected String doDelete(String id, @Nullable String routing, IndexCoordinates
227227
return execute(client -> client.delete(request, RequestOptions.DEFAULT).getId());
228228
}
229229

230-
@Override
231-
public ByQueryResponse delete(Query query, Class<?> clazz, IndexCoordinates index) {
232-
DeleteByQueryRequest deleteByQueryRequest =
233-
requestFactory.deleteByQueryRequest(query, routingResolver.getRouting(), clazz, index, this.refreshPolicy);
234-
return ResponseConverter.byQueryResponseOf(
235-
execute(client -> client.deleteByQuery(deleteByQueryRequest, RequestOptions.DEFAULT)));
236-
}
237-
238230
@Override
239231
public ByQueryResponse delete(DeleteQuery query, Class<?> clazz) {
240232
return delete(query, clazz, getIndexCoordinatesFor(clazz));

spring-data-opensearch/src/main/java/org/opensearch/data/client/osc/OpenSearchTemplate.java

-13
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,6 @@ public ByQueryResponse delete(DeleteQuery query, Class<?> clazz, IndexCoordinate
197197
return responseConverter.byQueryResponse(response);
198198
}
199199

200-
@Override
201-
public ByQueryResponse delete(Query query, Class<?> clazz, IndexCoordinates index) {
202-
203-
Assert.notNull(query, "query must not be null");
204-
205-
DeleteByQueryRequest request = requestConverter.documentDeleteByQueryRequest(query, routingResolver.getRouting(),
206-
clazz, index, getRefreshPolicy());
207-
208-
DeleteByQueryResponse response = execute(client -> client.deleteByQuery(request));
209-
210-
return responseConverter.byQueryResponse(response);
211-
}
212-
213200
@Override
214201
public UpdateResponse update(UpdateQuery updateQuery, IndexCoordinates index) {
215202

spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchIntegrationTests.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ public void shouldDeleteDocumentForGivenQuery() {
576576

577577
// when
578578
Query query = getTermQuery("id", documentId);
579-
operations.delete(query, SampleEntity.class, IndexCoordinates.of(indexNameProvider.indexName()));
579+
operations.delete(DeleteQuery.builder(query).build(), SampleEntity.class, IndexCoordinates.of(indexNameProvider.indexName()));
580580

581581
// then
582582
Query searchQuery = getTermQuery("id", documentId);
@@ -607,7 +607,7 @@ public void shouldDeleteAcrossIndex() {
607607

608608
// when
609609
Query query = getTermQuery("message", "foo");
610-
operations.delete(query, SampleEntity.class, IndexCoordinates.of(MULTI_INDEX_ALL));
610+
operations.delete(DeleteQuery.builder(query).build(), SampleEntity.class, IndexCoordinates.of(MULTI_INDEX_ALL));
611611

612612
// then
613613
assertThat(operations.count(query, IndexCoordinates.of(MULTI_INDEX_1_NAME, MULTI_INDEX_2_NAME))).isEqualTo(0);
@@ -638,7 +638,7 @@ public void shouldDeleteAcrossIndexWhenNoMatchingDataPresent() {
638638
// when
639639
Query query = getTermQuery("message", "negative");
640640

641-
operations.delete(query, SampleEntity.class, IndexCoordinates.of("test-index-*"));
641+
operations.delete(DeleteQuery.builder(query).build(), SampleEntity.class, IndexCoordinates.of("test-index-*"));
642642

643643
operations.indexOps(IndexCoordinates.of(MULTI_INDEX_1_NAME)).refresh();
644644
operations.indexOps(IndexCoordinates.of(MULTI_INDEX_2_NAME)).refresh();
@@ -1001,7 +1001,7 @@ public void shouldDeleteGivenCriteriaQuery() {
10011001
CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria("message").contains("test"));
10021002

10031003
// when
1004-
operations.delete(criteriaQuery, SampleEntity.class, IndexCoordinates.of(indexNameProvider.indexName()));
1004+
operations.delete(DeleteQuery.builder(criteriaQuery).build(), SampleEntity.class, IndexCoordinates.of(indexNameProvider.indexName()));
10051005

10061006
// then
10071007
StringQuery stringQuery = new StringQuery(matchAllQuery().toString());
@@ -2433,7 +2433,7 @@ public void shouldDeleteOnlyDocumentsMatchedByDeleteQuery() {
24332433

24342434
// when
24352435
Query query = operations.idsQuery(Arrays.asList(documentIdToDelete));
2436-
operations.delete(query, SampleEntity.class, IndexCoordinates.of(indexNameProvider.indexName()));
2436+
operations.delete(DeleteQuery.builder(query).build(), SampleEntity.class, IndexCoordinates.of(indexNameProvider.indexName()));
24372437

24382438
// then
24392439
// document with id "remainingDocumentId" should still be indexed
@@ -2463,7 +2463,8 @@ public void shouldDeleteOnlyDocumentsMatchedByCriteriaQuery() {
24632463

24642464
// when
24652465
CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria("id").is(documentIdToDelete));
2466-
operations.delete(criteriaQuery, SampleEntity.class, IndexCoordinates.of(indexNameProvider.indexName()));
2466+
operations.delete(DeleteQuery.builder(criteriaQuery).build(), SampleEntity.class,
2467+
IndexCoordinates.of(indexNameProvider.indexName()));
24672468

24682469
// then
24692470
// document with id "remainingDocumentId" should still be indexed
@@ -3374,7 +3375,7 @@ private void shouldUpdateEntityWithJoinFields(String qId1, String qId2, String a
33743375

33753376
private void shouldDeleteEntityWithJoinFields(String qId2, String aId2) throws Exception {
33763377

3377-
operations.delete(getQueryForParentId("answer", qId2, qId2), SampleJoinEntity.class,
3378+
operations.delete(DeleteQuery.builder(getQueryForParentId("answer", qId2, qId2)).build(), SampleJoinEntity.class,
33783379
IndexCoordinates.of(indexNameProvider.indexName()));
33793380

33803381
SearchHits<SampleJoinEntity> deletedHits = operations.search(getQueryForParentId("answer", qId2, null),

spring-data-opensearch/src/test/java/org/springframework/data/elasticsearch/core/query/ElasticsearchPartQueryIntegrationTests.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@
3434
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
3535
import org.springframework.data.elasticsearch.repository.query.ElasticsearchPartQuery;
3636
import org.springframework.data.elasticsearch.repository.query.ElasticsearchQueryMethod;
37+
import org.springframework.data.elasticsearch.repository.query.RepositoryPartQuery;
3738
import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
3839
import org.springframework.data.repository.core.support.DefaultRepositoryMetadata;
39-
import org.springframework.data.repository.query.QueryMethodEvaluationContextProvider;
40+
import org.springframework.data.repository.query.ValueExpressionDelegate;
4041
import org.springframework.lang.Nullable;
4142

4243
/**
@@ -648,7 +649,7 @@ private String getQueryString(String methodName, Class<?>[] parameterClasses, Ob
648649
ElasticsearchQueryMethod queryMethod = new ElasticsearchQueryMethod(method,
649650
new DefaultRepositoryMetadata(SampleRepository.class), new SpelAwareProxyProjectionFactory(),
650651
operations.getElasticsearchConverter().getMappingContext());
651-
ElasticsearchPartQuery partQuery = new ElasticsearchPartQuery(queryMethod, operations, QueryMethodEvaluationContextProvider.DEFAULT);
652+
RepositoryPartQuery partQuery = new RepositoryPartQuery(queryMethod, operations, ValueExpressionDelegate.create());
652653
Query query = partQuery.createQuery(parameters);
653654
return buildQueryString(query, Book.class);
654655
}

version.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=1.6.3
1+
version=1.7.0

0 commit comments

Comments
 (0)