asereda-gs commented on a change in pull request #1813: fix elasticsearch fetch
mapping
URL: https://github.com/apache/calcite/pull/1813#discussion_r380194978
##########
File path:
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchTransport.java
##########
@@ -118,7 +120,14 @@ private ElasticsearchVersion version() {
* Build index mapping returning new instance of {@link
ElasticsearchMapping}.
*/
private ElasticsearchMapping fetchAndCreateMapping() {
- final String uri = String.format(Locale.ROOT, "/%s/_mapping", indexName);
+ String encodedIndexName = indexName;
+ try {
+ encodedIndexName = URLEncoder.encode(indexName,
StandardCharsets.UTF_8.toString());
+ } catch (Exception e) {
Review comment:
Does it make sense to (re)use
[URIBuilder](https://hc.apache.org/httpcomponents-client-4.3.x/httpclient/apidocs/org/apache/http/client/utils/URIBuilder.html)
?
I think it encodes path segments automatically.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services