[ 
https://issues.apache.org/jira/browse/CALCITE-3802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

jerryleooo updated CALCITE-3802:
--------------------------------
    Description: 
In 
[https://github.com/apache/calcite/blob/master/elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchTransport.java#L121]
 when the indexName has some special characters, the request will fail for 
Elasticsearch server returning HTTP 400 error.

 
{code:java}
val connection = DriverManager.getConnection("jdbc:calcite:") 
val calciteConnection = connection.asInstanceOf[CalciteConnection] 
val rootSchema = calciteConnection.getRootSchema()
val esProperties = new util.HashMap[String, AnyRef]()
esProperties.put("coordinates", "{'elasticsearch url': 80}") 
rootSchema.add("es", new ElasticsearchSchemaFactory().create(rootSchema, "es", 
esProperties))
{code}
!image-2020-02-17-16-09-20-794.png!

 

  was:
In 
[https://github.com/apache/calcite/blob/master/elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchTransport.java#L121]
 when the indexName has some special characters, the request will fail for 
Elasticsearch server returning HTTP 400 error.

 
{code:java}
val connection = DriverManager.getConnection("jdbc:calcite:") 
val calciteConnection = connection.asInstanceOf[CalciteConnection] 
val rootSchema = calciteConnection.getRootSchema()
val esProperties = new util.HashMap[String, AnyRef]()
esProperties.put("coordinates", 
"{'search-druid-n5sle4a4vagg7zomopqu6ssc6a.ap-southeast-1.es.amazonaws.com': 
80}") 
rootSchema.add("es", new ElasticsearchSchemaFactory().create(rootSchema, "es", 
esProperties))
{code}
!image-2020-02-17-16-09-20-794.png!

 


> Calcite Elasticsearch adapter should encode the URI before send the request
> ---------------------------------------------------------------------------
>
>                 Key: CALCITE-3802
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3802
>             Project: Calcite
>          Issue Type: Bug
>          Components: elasticsearch-adapter
>    Affects Versions: 1.21.0
>            Reporter: jerryleooo
>            Priority: Major
>             Fix For: 1.22.0
>
>         Attachments: image-2020-02-17-16-09-20-794.png
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In 
> [https://github.com/apache/calcite/blob/master/elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchTransport.java#L121]
>  when the indexName has some special characters, the request will fail for 
> Elasticsearch server returning HTTP 400 error.
>  
> {code:java}
> val connection = DriverManager.getConnection("jdbc:calcite:") 
> val calciteConnection = connection.asInstanceOf[CalciteConnection] 
> val rootSchema = calciteConnection.getRootSchema()
> val esProperties = new util.HashMap[String, AnyRef]()
> esProperties.put("coordinates", "{'elasticsearch url': 80}") 
> rootSchema.add("es", new ElasticsearchSchemaFactory().create(rootSchema, 
> "es", esProperties))
> {code}
> !image-2020-02-17-16-09-20-794.png!
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to