package fr.insee.pogues.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ElasticContext {

    @Value("${fr.insee.pogues.elasticsearch.cluster.name}")
    private String clusterName;

    @Value("${fr.insee.pogues.elasticsearch.host}")
    private String host;

    @Value("${fr.insee.pogues.elasticsearch.port}")
    private int port;

    @Bean
    public RestHighLevelClient client() throws Exception {
        RestClient lowLevelClient = RestClient.builder(
                new HttpHost(host, port, "http")).build();
//        Settings settings = Settings.builder()
//                .put("cluster.name", clusterName)
//                .build();
//        return new PreBuiltTransportClient(settings)
//                .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(host), port));
        return new RestHighLevelClient(lowLevelClient);
    }

}

@@ -809,299 +809,8 @@
 ();%0A
-//        Settings settings = Settings.builder()%0A//                .put(%22cluster.name%22, clusterName)%0A//                .build();%0A//        return new PreBuiltTransportClient(settings)%0A//                .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(host), port));%0A
     

Remove useless comments