|
30 | 30 | import org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter;
|
31 | 31 | import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
32 | 32 | import org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext;
|
| 33 | +import org.springframework.data.elasticsearch.core.query.Criteria; |
| 34 | +import org.springframework.data.elasticsearch.core.query.CriteriaQuery; |
| 35 | +import org.springframework.data.elasticsearch.core.query.DeleteQuery; |
33 | 36 | import org.springframework.data.elasticsearch.core.query.DocValueField;
|
34 | 37 | import org.springframework.data.elasticsearch.core.query.StringQuery;
|
35 | 38 | import org.springframework.lang.Nullable;
|
36 | 39 |
|
37 | 40 | /**
|
38 | 41 | * @author Peter-Josef Meisch
|
| 42 | + * @author Han Seungwoo |
39 | 43 | */
|
40 | 44 | class RequestConverterTest {
|
41 | 45 |
|
@@ -72,6 +76,19 @@ void shouldAddDocvalueFields() {
|
72 | 76 | assertThat(fieldAndFormats.get(1).format()).isEqualTo("format2");
|
73 | 77 | }
|
74 | 78 |
|
| 79 | + @Test // #2973 |
| 80 | + @DisplayName("should set refresh based on deleteRequest") |
| 81 | + void refreshSetByDeleteRequest() { |
| 82 | + var query = new CriteriaQuery(new Criteria("text").contains("test")); |
| 83 | + var deleteQuery = DeleteQuery.builder(query).withRefresh(true).build(); |
| 84 | + |
| 85 | + var deleteByQueryRequest = requestConverter.documentDeleteByQueryRequest(deleteQuery, null, SampleEntity.class, |
| 86 | + IndexCoordinates.of("foo"), |
| 87 | + null); |
| 88 | + |
| 89 | + assertThat(deleteByQueryRequest.refresh()).isTrue(); |
| 90 | + } |
| 91 | + |
75 | 92 | @Document(indexName = "does-not-matter")
|
76 | 93 | static class SampleEntity {
|
77 | 94 | @Nullable
|
|
0 commit comments