ES之RestHighLevelClient

ES之RestHighLevelClient,第1张

ES之RestHighLevelClient
package com.luding.diankan.es.utils;

import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.Arrays;



@Component
public class ElasticsearchConfig {
    @Value("${elasticSearch.url}")
    private String esUrl;
    @Value("${elasticSearch.port}")
    private String esPort;

    @Value("${elasticSearch.indexName}")
    private String esIndexName;


    @Bean
    public RestHighLevelClient restHighLevelClient() {
        String[] ips = esUrl.split(",");
        Ht

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5590693.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-14

发表评论

登录后才能评论

评论列表(0条)

保存