You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Chunwei Lei (Jira)" <ji...@apache.org> on 2020/09/02 02:42:00 UTC

[jira] [Updated] (CALCITE-4180) Support for Elasticsearch basic authentication

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

Chunwei Lei updated CALCITE-4180:
---------------------------------
    Summary: Support for Elasticsearch basic authentication  (was: Where to set elasticsearch username/password?)

> Support for Elasticsearch basic authentication
> ----------------------------------------------
>
>                 Key: CALCITE-4180
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4180
>             Project: Calcite
>          Issue Type: Bug
>          Components: elasticsearch-adapter
>            Reporter: fa
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
>  
> {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)