Search in sources :

Example 1 with ElasticsearchTransport

use of co.elastic.clients.transport.ElasticsearchTransport in project micronaut-elasticsearch by micronaut-projects.

the class DefaultElasticsearchClientFactory method elasticsearchTransport.

/**
 * @param elasticsearchConfiguration The {@link DefaultElasticsearchConfigurationProperties} object.
 * @param objectMapper The {@link ObjectMapper} object.
 * @return The {@link ElasticsearchTransport}.
 * @since 4.2.0
 */
@Singleton
@Bean(preDestroy = "close")
ElasticsearchTransport elasticsearchTransport(DefaultElasticsearchConfigurationProperties elasticsearchConfiguration, ObjectMapper objectMapper) {
    RestClient restClient = restClientBuilder(elasticsearchConfiguration).build();
    ElasticsearchTransport transport = new RestClientTransport(restClient, new JacksonJsonpMapper(objectMapper));
    return transport;
}
Also used : ElasticsearchTransport(co.elastic.clients.transport.ElasticsearchTransport) RestClientTransport(co.elastic.clients.transport.rest_client.RestClientTransport) RestClient(org.elasticsearch.client.RestClient) JacksonJsonpMapper(co.elastic.clients.json.jackson.JacksonJsonpMapper) Singleton(jakarta.inject.Singleton) Bean(io.micronaut.context.annotation.Bean)

Aggregations

JacksonJsonpMapper (co.elastic.clients.json.jackson.JacksonJsonpMapper)1 ElasticsearchTransport (co.elastic.clients.transport.ElasticsearchTransport)1 RestClientTransport (co.elastic.clients.transport.rest_client.RestClientTransport)1 Bean (io.micronaut.context.annotation.Bean)1 Singleton (jakarta.inject.Singleton)1 RestClient (org.elasticsearch.client.RestClient)1