Skip to content

Commit

Permalink
Revert "Move to elasticsearch-java 8. Removed the use of RestHighLeve…
Browse files Browse the repository at this point in the history
…lClient and xcontent (#320)"

This reverts commit 48e0b0c.
  • Loading branch information
sdelamo committed Aug 2, 2022
1 parent 17f8b73 commit ddb0a78
Show file tree
Hide file tree
Showing 24 changed files with 434 additions and 427 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

202 changes: 0 additions & 202 deletions config/accepted-api-changes.json

This file was deleted.

1 change: 1 addition & 0 deletions elasticsearch/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {

dependencies {
annotationProcessor mn.micronaut.graal
api "org.elasticsearch.client:elasticsearch-rest-high-level-client:$elasticsearchVersion"
api "co.elastic.clients:elasticsearch-java:$elasticsearchVersion"
api mn.micronaut.http
api mn.micronaut.validation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;

import co.elastic.clients.elasticsearch.ElasticsearchAsyncClient;
import co.elastic.clients.elasticsearch.ElasticsearchClient;
Expand All @@ -43,6 +44,17 @@
@Factory
public class DefaultElasticsearchClientFactory {

/**
* Create the {@link RestHighLevelClient} bean for the given configuration.
*
* @param elasticsearchConfiguration The {@link DefaultElasticsearchConfigurationProperties} object
* @return A {@link RestHighLevelClient} bean
*/
@Bean(preDestroy = "close")
RestHighLevelClient restHighLevelClient(DefaultElasticsearchConfigurationProperties elasticsearchConfiguration) {
return new RestHighLevelClient(restClientBuilder(elasticsearchConfiguration));
}

/**
* @param elasticsearchConfiguration The {@link DefaultElasticsearchConfigurationProperties} object
* @return The Elasticsearch Rest Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
import io.micronaut.context.annotation.Factory;
import io.micronaut.context.annotation.Requires;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;

import jakarta.inject.Singleton;
import org.elasticsearch.client.RestClient;

/**
* The default factory used to create {@link HttpAsyncClientBuilder} for HTTP client configurations.
*
* @author Puneet Behl
* @since 1.0.0
*/
@Requires(classes = {RestClient.class})
@Requires(classes = {RestHighLevelClient.class})
@Factory
public class DefaultHttpAsyncClientBuilderFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import io.micronaut.elasticsearch.ElasticsearchSettings;
import io.micronaut.context.annotation.Requires;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;

import java.lang.annotation.*;

Expand All @@ -31,6 +31,6 @@
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PACKAGE, ElementType.TYPE})
@Requires(property = ElasticsearchSettings.PREFIX)
@Requires(classes = {RestClient.class})
@Requires(classes = {RestHighLevelClient.class})
public @interface RequiresElasticsearch {
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
*
* We substitute it with an implementation which does not use serialization.
*
* Forked from Quarkus: https://github.com/quarkusio/quarkus/blob/main/extensions/elasticsearch-rest-client-common/runtime/src/main/java/io/quarkus/elasticsearch/restclient/common/runtime/graal/Substitute_RestClient.java
* Forked from Quarkus: https://github.com/quarkusio/quarkus/blob/c9cba824e8812fa3f15474b8382ac5d90f7238aa/extensions/elasticsearch-rest-client/runtime/src/main/java/io/quarkus/elasticsearch/restclient/runtime/graal/Substitute_RestClient.java
*
* @author Iván López
* @since 2.0.0
Expand Down Expand Up @@ -109,7 +109,7 @@ public NoSerializationBasicAuthCache() {
this(null);
}

private HttpHost getKey(final HttpHost host) {
protected HttpHost getKey(final HttpHost host) {
if (host.getPort() <= 0) {
final int port;
try {
Expand Down
Loading

0 comments on commit ddb0a78

Please sign in to comment.