[
https://issues.apache.org/jira/browse/CALCITE-4180?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Danny Chen resolved CALCITE-4180.
---------------------------------
Fix Version/s: 1.26.0
Assignee: Danny Chen
Resolution: Fixed
Fixed in
[e9f9261|https://github.com/apache/calcite/commit/e9f926165c035ff62942dea318c5820ed69c1124],
thanks for the PR, [~geiguanbing] !
> 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
> Assignee: Danny Chen
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.26.0
>
> Time Spent: 40m
> 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)