Java Code Examples for org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate#getClient()

The following examples show how to use org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate#getClient() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SearchBuilder.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
/**
 * 生成SearchBuilder实例
 * @param elasticsearchTemplate
 * @param indexName
 */
public static SearchBuilder builder(ElasticsearchRestTemplate elasticsearchTemplate, String indexName) {
    SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
    SearchRequest searchRequest = new SearchRequest(indexName);
    searchRequest.source(searchSourceBuilder);
    RestHighLevelClient client = elasticsearchTemplate.getClient();
    return new SearchBuilder(searchRequest, searchSourceBuilder, client);
}
 
Example 2
Source File: SearchBuilder.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
/**
 * 生成SearchBuilder实例
 * @param elasticsearchTemplate
 */
public static SearchBuilder builder(ElasticsearchRestTemplate elasticsearchTemplate) {
    SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
    SearchRequest searchRequest = new SearchRequest();
    searchRequest.source(searchSourceBuilder);
    RestHighLevelClient client = elasticsearchTemplate.getClient();
    return new SearchBuilder(searchRequest, searchSourceBuilder, client);
}