Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4180

Support for Elasticsearch basic authentication

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

      Description

       

      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);
              }
          }
      }
      

       

       

      es.json

      {
        "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"
            }
          }
        ]
      }
      

      and throw Exception

      {
          "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
      }
      

      Where to set Elasticsearch username/password?

        Attachments

          Activity

            People

            • Assignee:
              danny0405 Danny Chen
              Reporter:
              geiguanbing fa

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m

                  Issue deployment