0

How to express the scheme(https) in the model.json file, this is for connection to Elasticsearch?

The following is the model.js file:

{
  "version": "1.0",
  "defaultSchema": "elasticsearch",
  "schemas": [
    {
      "type": "custom",
      "name": "elasticsearch",
      "factory": "org.apache.calcite.adapter.elasticsearch.ElasticsearchSchemaFactory",
      "operand": {
        "coordinates": "{'127.0.0.1': 9200}",
        "index": "myIndex",
        "useConig": "{}"
      }
    }
  ]
}

In the following JAVA code I am trying to connect to Elasticsearch:

Connection conn = DriverManager.getConnection("jdbc:calcite:", properties);
calciteConnection = conn.unwrap(CalciteConnection.class);
String elasticSchema = Resources.toString(somefile.class.getResource("/model.json"), Charset.defaultCharset());

new ModelHandler(calciteConnection, "inline:" + elasticSchema);

String sql = “select field1 from table1”
statement2 = calciteConnection.prepareStatement(sql);
ResultSet set = statement2.executeQuery();

The get a connection closed exception and I can see in the log that it was trying to connect to http not https(desired). Where do I mention https in the model file?

f_puras
  • 2,521
  • 4
  • 33
  • 38

1 Answers1

0

Calcite's Elasticsearch adapter doesn't currently support connections via HTTPS. I'd suggest you open up an issue on Calcite's JIRA. Or better yet, contribute the necessary code changes yourself :)

Michael Mior
  • 28,107
  • 9
  • 89
  • 113