org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate Java Examples

The following examples show how to use org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate. 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);
}
 
Example #3
Source File: RestAutoConfigure.java    From microservices-platform with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public ElasticsearchRestTemplate elasticsearchRestTemplate(RestHighLevelClient restHighLevelClient) {
    return new ElasticsearchRestTemplate(restHighLevelClient);
}
 
Example #4
Source File: SearchServiceImpl.java    From microservices-platform with Apache License 2.0 4 votes vote down vote up
public SearchServiceImpl(ElasticsearchRestTemplate elasticsearchRestTemplate) {
    this.elasticsearchRestTemplate = elasticsearchRestTemplate;
}
 
Example #5
Source File: AggregationServiceImpl.java    From microservices-platform with Apache License 2.0 4 votes vote down vote up
public AggregationServiceImpl(ElasticsearchRestTemplate elasticsearchRestTemplate) {
    this.elasticsearchRestTemplate = elasticsearchRestTemplate;
}
 
Example #6
Source File: ElasticsearchConfig.java    From adaptive-alerting with Apache License 2.0 4 votes vote down vote up
@Bean
public ElasticsearchRestTemplate elasticsearchTemplate() {
    return new ElasticsearchRestTemplate(client());
}
 
Example #7
Source File: Config.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
public ElasticsearchOperations elasticsearchTemplate() {
    return new ElasticsearchRestTemplate(client());
}