Skip to content

Commit 97d0566

Browse files
authored
Fix msearch setup after ES fixed it's issue.
Original Pull Request #2176 Closes #2138
1 parent ac64a6a commit 97d0566

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/main/java/org/springframework/data/elasticsearch/client/elc/RequestConverter.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1049,12 +1049,13 @@ public MsearchRequest searchMsearchRequest(
10491049

10501050
mrb.searches(sb -> sb //
10511051
.header(h -> h //
1052-
.index(param.index.getIndexName()) //
1052+
.index(Arrays.asList(param.index.getIndexNames())) //
10531053
// todo #2156 add remaining flags for header
10541054
) //
10551055
.body(bb -> bb //
10561056
.query(getQuery(param.query, param.clazz))//
1057-
// todo #2138 seq_no_primary_term and version not available in client ES issue 161
1057+
.seqNoPrimaryTerm(persistentEntity.hasSeqNoPrimaryTermProperty())
1058+
.version(true)
10581059
// todo #2156 add remaining flags for body
10591060
) //
10601061
);

src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchIntegrationTests.java

+3-12
Original file line numberDiff line numberDiff line change
@@ -1616,9 +1616,6 @@ public void shouldPassIndicesOptionsForGivenSearchScrollQuery() {
16161616
assertThat(entities.size()).isGreaterThanOrEqualTo(1);
16171617
}
16181618

1619-
@DisabledIf(value = "newElasticsearchClient",
1620-
disabledReason = "todo #2138 can't check response, open ES issue 161 that does not allow seqno")
1621-
// and version to be set in the request
16221619
@Test // DATAES-487
16231620
public void shouldReturnSameEntityForMultiSearch() {
16241621

@@ -1641,13 +1638,9 @@ public void shouldReturnSameEntityForMultiSearch() {
16411638
}
16421639
}
16431640

1644-
@DisabledIf(value = "newElasticsearchClient",
1645-
disabledReason = "todo #2138 can't check response, open ES issue 161 that does not allow seqno")
1646-
// and version to be set in the request
16471641
@Test // DATAES-487
16481642
public void shouldReturnDifferentEntityForMultiSearch() {
16491643

1650-
Class<Book> clazz = Book.class;
16511644
IndexOperations bookIndexOperations = operations.indexOps(Book.class);
16521645
bookIndexOperations.delete();
16531646
bookIndexOperations.createWithMapping();
@@ -1662,7 +1655,8 @@ public void shouldReturnDifferentEntityForMultiSearch() {
16621655
queries.add(getTermQuery("message", "ab"));
16631656
queries.add(getTermQuery("description", "bc"));
16641657

1665-
List<SearchHits<?>> searchHitsList = operations.multiSearch(queries, Lists.newArrayList(SampleEntity.class, clazz),
1658+
List<SearchHits<?>> searchHitsList = operations.multiSearch(queries, Lists.newArrayList(SampleEntity.class,
1659+
Book.class),
16661660
IndexCoordinates.of(indexNameProvider.indexName(), bookIndex.getIndexName()));
16671661

16681662
bookIndexOperations.delete();
@@ -1674,7 +1668,7 @@ public void shouldReturnDifferentEntityForMultiSearch() {
16741668
SearchHits<?> searchHits1 = searchHitsList.get(1);
16751669
assertThat(searchHits1.getTotalHits()).isEqualTo(1L);
16761670
SearchHit<Book> searchHit1 = (SearchHit<Book>) searchHits1.getSearchHit(0);
1677-
assertThat(searchHit1.getContent().getClass()).isEqualTo(clazz);
1671+
assertThat(searchHit1.getContent().getClass()).isEqualTo(Book.class);
16781672
}
16791673

16801674
@Test
@@ -3070,9 +3064,6 @@ void searchShouldReturnSeqNoPrimaryTerm() {
30703064
assertThatSeqNoPrimaryTermIsFilled(retrieved);
30713065
}
30723066

3073-
@DisabledIf(value = "newElasticsearchClient",
3074-
disabledReason = "todo #2138 can't check response, open ES issue 161 that does not allow seqno")
3075-
// and version to be set in the request
30763067
@Test // DATAES-799
30773068
void multiSearchShouldReturnSeqNoPrimaryTerm() {
30783069
OptimisticEntity original = new OptimisticEntity();

0 commit comments

Comments
 (0)