You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "fa (Jira)" <ji...@apache.org> on 2020/08/18 08:43:00 UTC
[jira] [Created] (CALCITE-4180) Where to set elasticsearch
username/password?
fa created CALCITE-4180:
---------------------------
Summary: Where to set elasticsearch username/password?
Key: CALCITE-4180
URL: https://issues.apache.org/jira/browse/CALCITE-4180
Project: Calcite
Issue Type: Bug
Components: elasticsearch-adapter
Reporter: fa
{code:java}
Properties config = new Properties();
config.put("lex", "JAVA");
String sql = "select * from index";
try (Connection con = DriverManager.getConnection("jdbc:calcite:model=src/main/resources/es.json", config)) {
try (Statement stmt = con.createStatement()) {
try (ResultSet rs = stmt.executeQuery(sql)) {
printRs(rs);
}
}
}
{code}
es.json
{code:java}
{
"version": "1.0",
"defaultSchema": "elasticsearch",
"schemas": [
{
"type": "custom",
"name": "elasticsearch",
"factory": "org.apache.calcite.adapter.elasticsearch.ElasticsearchSchemaFactory",
"operand": {
"coordinates": "{'192.168.133.104': 9200}",
"jdbcUser": "elastic",
"jdbcPassword": "elastic"
}
}
]
}
{code}
and throw Exception
{code:java}
{
"error":{
"root_cause":[
{
"type":"security_exception",
"reason":"missing authentication token for REST request [/_alias]",
"header":{
"WWW-Authenticate":"Basic realm="security" charset="UTF-8""
}
}
],
"type":"security_exception",
"reason":"missing authentication token for REST request [/_alias]",
"header":{
"WWW-Authenticate":"Basic realm="security" charset="UTF-8""
}
},
"status":401
}
{code}
Where to set Elasticsearch username/password?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)