You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by GitBox <gi...@apache.org> on 2022/05/12 14:55:33 UTC
[GitHub] [jackrabbit-oak] nit0906 commented on a diff in pull request #490: OAK-9686: replace Elastic RHLC with Elastic Java Client
nit0906 commented on code in PR #490:
URL: https://github.com/apache/jackrabbit-oak/pull/490#discussion_r871484626
##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticConnection.java:
##########
@@ -108,11 +123,41 @@ public RestHighLevelClient getClient() {
Header[] headers = new Header[]{new BasicHeader("Authorization", "ApiKey " + apiKeyAuth)};
builder.setDefaultHeaders(headers);
}
- client = new RestHighLevelClient(builder);
+ RestClient httpClient = builder.build();
+ hlClient = new RestHighLevelClientBuilder(httpClient).setApiCompatibilityMode(true).build();
+
+ ElasticsearchTransport transport = new RestClientTransport(
+ httpClient, new JacksonJsonpMapper());
+ esClient = new ElasticsearchClient(transport);
+ esAsyncClient = new ElasticsearchAsyncClient(transport);
}
}
}
- return client;
+ return Tuple.tuple(Tuple.tuple(esClient, esAsyncClient), hlClient);
+ }
+
+ /**
+ * Gets the Elasticsearch Client
+ * @return the Elasticsearch client
+ */
+ public ElasticsearchClient getClient() {
+ return getClients().v1().v1();
Review Comment:
I know this is temporary and we will eventually remove the hlc later on - but I was wondering is we can still maybe return a map from getClients() ?
The v1().v1() is pretty confusing (especially when in context of clients) - v1() immediately makes me think of client/api versioning and not of getting the first value from tupple.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org