Skip to content

Commit

Permalink
Path prefix is added back
Browse files Browse the repository at this point in the history
  • Loading branch information
dadoonet committed Sep 13, 2024
1 parent bfd3aec commit 4e49128
Showing 1 changed file with 6 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,35 +116,6 @@ public void start() throws ElasticsearchClientException {
return;
}

/*
if (settings.getPathPrefix() != null) {
builder.setPathPrefix(settings.getPathPrefix());
}
if (settings.getUsername() != null) {
if (settings.getSslVerification()) {
builder.setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider));
} else {
builder.setHttpClientConfigCallback(httpClientBuilder -> {
SSLContext sc;
try {
sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new SecureRandom());
} catch (KeyManagementException | NoSuchAlgorithmException e) {
logger.warn("Failed to get SSL Context", e);
throw new RuntimeException(e);
}
httpClientBuilder.setSSLStrategy(new SSLIOSessionStrategy(sc, new NullHostNameVerifier()));
httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
return httpClientBuilder;
});
}
}
return builder;
}
*/

// Create the client
ClientConfig config = new ClientConfig();
// We need to suppress this, so we can do DELETE with body
Expand Down Expand Up @@ -196,7 +167,7 @@ public void start() throws ElasticsearchClientException {
if (sslContext != null) {
clientBuilder.sslContext(sslContext);
}
client = clientBuilder.build();
client = clientBuilder.build();
if (logger.isTraceEnabled()) {
client
// .property(LoggingFeature.LOGGING_FEATURE_LOGGER_NAME_CLIENT, ElasticsearchClient.class.getName())
Expand Down Expand Up @@ -914,8 +885,12 @@ private String httpDelete(String path, Object data) throws ElasticsearchClientEx
}

@SafeVarargs
private String httpCall(String method, String path, Object data, Map.Entry<String, Object>... params) throws ElasticsearchClientException {
private String httpCall(String method, String localPath, Object data, Map.Entry<String, Object>... params) throws ElasticsearchClientException {
String node = getNode();
String path = localPath;
if (settings.getElasticsearch().getPathPrefix() != null) {
path = settings.getElasticsearch().getPathPrefix() + "/" + localPath;
}
logger.trace("Calling {} {}/{} with params {}", method, node, path == null ? "" : path, params);
try {
Invocation.Builder callBuilder = prepareHttpCall(node, path, params);
Expand Down

0 comments on commit 4e49128

Please sign in to comment.