You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/04/03 19:12:52 UTC
[GitHub] [beam] fcaylus commented on a change in pull request #14345: [BEAM-12012] Add API key & token authentication in ElasticsearchIO
fcaylus commented on a change in pull request #14345:
URL: https://github.com/apache/beam/pull/14345#discussion_r606699782
##########
File path: sdks/java/io/elasticsearch/src/main/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIO.java
##########
@@ -424,6 +460,14 @@ RestClient createClient() throws IOException {
httpAsyncClientBuilder ->
httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider));
}
+ if (getApiKey() != null) {
+ restClientBuilder.setDefaultHeaders(
+ new Header[] {new BasicHeader("Authorization", "ApiKey " + getApiKey())});
Review comment:
After some research, there is no way in the Elasticsearch SDK to retrieve the headers of a request (or the default headers of the `RestClient`). I don't think there is an "easy way" to test it.
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org