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

Elasticsearch adapter throws ClassCastException when index mapping sets dynamic_templates without properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.35.0
    • 1.36.0
    • None

    Description

      When we use the elasticsearch-adapter, as we config an elasticsearch cluster, it will fetchMapping during initialization.

      If a index set dynamic_templates bug no mappings like this:
       

      {
        "test_index" : {
          "mappings" : {
            "dynamic_templates" : [
              {
                "integers" : {
                  "match_mapping_type" : "long",
                  "mapping" : {
                    "type" : "integer"
                  }
                }
              }
            ]
          }
        }
      } 

      org.apache.calcite.adapter.elasticsearch.ElasticsearchJson#visitMappingProperties throw exception:

       

      java.lang.ClassCastException: 
      com.fasterxml.jackson.databind.node.ArrayNode cannot be cast to com.fasterxml.jackson.databind.node.ObjectNode
      at
       org.apache.calcite.adapter.elasticsearch.ElasticsearchJson.visitMappingProperties(ElasticsearchJson.java:133)
        

      So ElasticsearchTransport initialize failed, all index of this es cluster access failed.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              zoovwang zhaowang
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: