From a2e3e701112ed2f6d1b90c03e2b34924f952c6f2 Mon Sep 17 00:00:00 2001 From: Peter-Josef Meisch Date: Wed, 1 Jun 2022 14:40:02 +0200 Subject: [PATCH] fix mseearch setup after ES fixed it's issue --- .../client/elc/RequestConverter.java | 5 +++-- .../core/ElasticsearchIntegrationTests.java | 15 +++------------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/springframework/data/elasticsearch/client/elc/RequestConverter.java b/src/main/java/org/springframework/data/elasticsearch/client/elc/RequestConverter.java index 78df81450..3051591e7 100644 --- a/src/main/java/org/springframework/data/elasticsearch/client/elc/RequestConverter.java +++ b/src/main/java/org/springframework/data/elasticsearch/client/elc/RequestConverter.java @@ -1049,12 +1049,13 @@ public MsearchRequest searchMsearchRequest( mrb.searches(sb -> sb // .header(h -> h // - .index(param.index.getIndexName()) // + .index(Arrays.asList(param.index.getIndexNames())) // // todo #2156 add remaining flags for header ) // .body(bb -> bb // .query(getQuery(param.query, param.clazz))// - // todo #2138 seq_no_primary_term and version not available in client ES issue 161 + .seqNoPrimaryTerm(persistentEntity.hasSeqNoPrimaryTermProperty()) + .version(true) // todo #2156 add remaining flags for body ) // ); diff --git a/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchIntegrationTests.java b/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchIntegrationTests.java index a58cc2b01..33e23baf0 100755 --- a/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchIntegrationTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchIntegrationTests.java @@ -1616,9 +1616,6 @@ public void shouldPassIndicesOptionsForGivenSearchScrollQuery() { assertThat(entities.size()).isGreaterThanOrEqualTo(1); } - @DisabledIf(value = "newElasticsearchClient", - disabledReason = "todo #2138 can't check response, open ES issue 161 that does not allow seqno") - // and version to be set in the request @Test // DATAES-487 public void shouldReturnSameEntityForMultiSearch() { @@ -1641,13 +1638,9 @@ public void shouldReturnSameEntityForMultiSearch() { } } - @DisabledIf(value = "newElasticsearchClient", - disabledReason = "todo #2138 can't check response, open ES issue 161 that does not allow seqno") - // and version to be set in the request @Test // DATAES-487 public void shouldReturnDifferentEntityForMultiSearch() { - Class clazz = Book.class; IndexOperations bookIndexOperations = operations.indexOps(Book.class); bookIndexOperations.delete(); bookIndexOperations.createWithMapping(); @@ -1662,7 +1655,8 @@ public void shouldReturnDifferentEntityForMultiSearch() { queries.add(getTermQuery("message", "ab")); queries.add(getTermQuery("description", "bc")); - List> searchHitsList = operations.multiSearch(queries, Lists.newArrayList(SampleEntity.class, clazz), + List> searchHitsList = operations.multiSearch(queries, Lists.newArrayList(SampleEntity.class, + Book.class), IndexCoordinates.of(indexNameProvider.indexName(), bookIndex.getIndexName())); bookIndexOperations.delete(); @@ -1674,7 +1668,7 @@ public void shouldReturnDifferentEntityForMultiSearch() { SearchHits searchHits1 = searchHitsList.get(1); assertThat(searchHits1.getTotalHits()).isEqualTo(1L); SearchHit searchHit1 = (SearchHit) searchHits1.getSearchHit(0); - assertThat(searchHit1.getContent().getClass()).isEqualTo(clazz); + assertThat(searchHit1.getContent().getClass()).isEqualTo(Book.class); } @Test @@ -3070,9 +3064,6 @@ void searchShouldReturnSeqNoPrimaryTerm() { assertThatSeqNoPrimaryTermIsFilled(retrieved); } - @DisabledIf(value = "newElasticsearchClient", - disabledReason = "todo #2138 can't check response, open ES issue 161 that does not allow seqno") - // and version to be set in the request @Test // DATAES-799 void multiSearchShouldReturnSeqNoPrimaryTerm() { OptimisticEntity original = new OptimisticEntity();