DATAES-643: Added searchType to prepareSearch() in RestTemplate (#310)

Original PR: #310
This commit is contained in:
Mathias Teier 2019-08-27 12:11:46 +02:00 committed by Peter-Josef Meisch
parent 4798136074
commit 054c02bd41
2 changed files with 10 additions and 0 deletions

View File

@ -140,6 +140,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
* @author Martin Choraine * @author Martin Choraine
* @author Farid Azaza * @author Farid Azaza
* @author Peter-Josef Meisch * @author Peter-Josef Meisch
* @author Mathias Teier
*/ */
public class ElasticsearchRestTemplate public class ElasticsearchRestTemplate
implements ElasticsearchOperations, EsClient<RestHighLevelClient>, ApplicationContextAware { implements ElasticsearchOperations, EsClient<RestHighLevelClient>, ApplicationContextAware {
@ -1328,6 +1329,10 @@ public class ElasticsearchRestTemplate
request.preference(query.getPreference()); request.preference(query.getPreference());
} }
if (query.getSearchType() != null) {
request.searchType(query.getSearchType());
}
request.source(sourceBuilder); request.source(sourceBuilder);
return request; return request;
} }

View File

@ -78,6 +78,7 @@ import org.springframework.util.Assert;
* @author Farid Azaza * @author Farid Azaza
* @author Martin Choraine * @author Martin Choraine
* @author Peter-Josef Meisch * @author Peter-Josef Meisch
* @author Mathias Teier
* @since 3.2 * @since 3.2
*/ */
public class ReactiveElasticsearchTemplate implements ReactiveElasticsearchOperations { public class ReactiveElasticsearchTemplate implements ReactiveElasticsearchOperations {
@ -283,6 +284,10 @@ public class ReactiveElasticsearchTemplate implements ReactiveElasticsearchOpera
request.preference(query.getPreference()); request.preference(query.getPreference());
} }
if (query.getSearchType() != null) {
request.searchType(query.getSearchType());
}
Pageable pageable = query.getPageable(); Pageable pageable = query.getPageable();
if (pageable.isPaged()) { if (pageable.isPaged()) {