Elasticsearch completion field with jdbc river


(Malkan) #1

I am using JDBC River to load data:

curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{
"type": "jdbc",
    "jdbc": {
    "url": "jdbc:mysql://localhost:3306/test",
        "user": "root",
        "password": "root",
        "sql": "SELECT TAD.ID AS _id, TAD.APP_NAME AS appName FROM TOPIC_APP_DETAILS TAD ",
        "index": "app_index",
        "type": "app_type",
        "mappings": {
        "app_type": {
            "properties": {
                "appName": {
                    "type": "completion"
                }
            }
        }
    }
}

}

And when I execute below query getting ClassCastException[org.elasticsearch.index.mapper.core.StringFieldMapper cannot be cast to org.elasticsearch.index.mapper.core.CompletionFieldMapper]

curl -X POST 'localhost:9200/app_index/_suggest?pretty' -d '{
"app-suggest" : {
    "text" : "cri",
        "completion" : {
        "field" : "appName"
    }
}

}

Please suggest what I am missing here.


(system) #2