# Elasticsearch completion field with jdbc river

**URL:** <https://discuss.elastic.co/t/elasticsearch-completion-field-with-jdbc-river/24683>\
**Category:** Elasticsearch\
**Created:** [July 1, 2015, 6:48am UTC](https://discuss.elastic.co/t/elasticsearch-completion-field-with-jdbc-river/24683 "2015-07-01T06:48:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yusuf](https://avatars.discourse-cdn.com/v4/letter/y/c68b51/32.png) [@Yusuf](https://discuss.elastic.co/u/Yusuf)\
**Post date:** [July 1, 2015, 6:48am UTC](https://discuss.elastic.co/t/elasticsearch-completion-field-with-jdbc-river/24683/1 "2015-07-01T06:48:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:04am UTC](https://discuss.elastic.co/t/elasticsearch-completion-field-with-jdbc-river/24683/2 "2017-07-06T00:04:24Z")

</div>


