# Elasticsearch completion field with jdbc river mapped data

**URL:** <https://discuss.elastic.co/t/elasticsearch-completion-field-with-jdbc-river-mapped-data/22126>\
**Category:** Elasticsearch\
**Created:** [February 12, 2015, 8:12am UTC](https://discuss.elastic.co/t/elasticsearch-completion-field-with-jdbc-river-mapped-data/22126 "2015-02-12T08:12:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antonio\_Matarrese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antonio_matarrese/32/913_2.png) [@Antonio\_Matarrese](https://discuss.elastic.co/u/Antonio_Matarrese)\
**Post date:** [February 12, 2015, 8:12am UTC](https://discuss.elastic.co/t/elasticsearch-completion-field-with-jdbc-river-mapped-data/22126/1 "2015-02-12T08:12:27Z")

</div>

I have made this mapping using jdbc river plugin for Elasticsearch:  
localhost:9200/\_river/product/\_meta

{  
"type": "jdbc",  
"jdbc": {  
"url": "jdbc:sqlserver://db.example.com;databaseName=training2",  
"user": "root",  
"password": "",  
"sql": "SELECT uuid as uuid, caption as caption FROM caption\_processed",  
"index": "example",  
"type": "product"  
}  
,  
"type\_mapping": {  
"product" : {  
"properties" : {  
"caption" : {  
"type" : "completion"  
}  
}  
}  
}}

And I made this query to test the suggest function:  
localhost:9200//example/\_suggest

{"product" : {  
"text" : "",  
"completion" : {  
"field" : "content"  
}}

}

This is the error that I get:

{  
"\_shards": {  
"total": 5,  
"successful": 0,  
"failed": 5,  
"failures": [  
{  
"index": "example",  
"shard": 0,  
"reason": "BroadcastShardOperationFailedException[[example][0] ]; nested: ElasticsearchException[failed to execute suggest]; nested: ClassCastException[org.elasticsearch.index.mapper.core.StringFieldMapper cannot be cast to org.elasticsearch.index.mapper.core.CompletionFieldMapper]; "  
},  
{  
"index": "example",  
"shard": 1,  
"reason": "BroadcastShardOperationFailedException[[example][1] ]; nested: ElasticsearchException[failed to execute suggest]; nested: ClassCastException[org.elasticsearch.index.mapper.core.StringFieldMapper cannot be cast to org.elasticsearch.index.mapper.core.CompletionFieldMapper]; "  
},

........................... }

Do you have any idea about what I'm doing wrongly?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d587a220-9dff-4bd0-a8a2-6d1713042579%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d587a220-9dff-4bd0-a8a2-6d1713042579%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:33am UTC](https://discuss.elastic.co/t/elasticsearch-completion-field-with-jdbc-river-mapped-data/22126/2 "2017-07-06T00:33:12Z")

</div>


