# JDBC river: trouble getting analyzer in type mapping to be applied

**URL:** <https://discuss.elastic.co/t/jdbc-river-trouble-getting-analyzer-in-type-mapping-to-be-applied/17990>\
**Category:** Elasticsearch\
**Created:** [June 9, 2014, 11:00am UTC](https://discuss.elastic.co/t/jdbc-river-trouble-getting-analyzer-in-type-mapping-to-be-applied/17990 "2014-06-09T11:00:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andre\_Morais](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@Andre\_Morais](https://discuss.elastic.co/u/Andre_Morais)\
**Post date:** [June 9, 2014, 11:00am UTC](https://discuss.elastic.co/t/jdbc-river-trouble-getting-analyzer-in-type-mapping-to-be-applied/17990/1 "2014-06-09T11:00:31Z")

</div>

Hello!

I'm creating an index with a JDBC river. In my type mapping I specify an  
analyzer defined in the YML and working properly. However, it is not  
applied to the field. When I check its mapping I see that the analyzer  
specification is not there. If I create a similar index directly on ES it  
works fine and appears in the mapping. Is there a syntax error somewhere in  
my river definition or am I missing something here?

Here is my JDBC river definition:

{  
"type": "jdbc",  
"jdbc": {  
"driver": "com.mysql.jdbc.Driver",  
"url": "jdbc:mysql://localhost:3306/clfb\_anoeee\_user",  
"user": "A",  
"password": "B",  
"sql": "select \* from vw\_IndexedUsers",  
"strategy": "oneshot",  
"index": "clfb\_anoeee\_user",  
"type": "clfb\_anoeee",  
"type\_mapping": "{ "clfb\_anoeee": { "properties":{ "LocName":{  
"type":"string", "index": "analyzed", "analyzer": "nodelim" } }  
} }"  
}  
}

And here is the mapping that ES reports having created:

curl -XGET  
'localhost:9200/clfb\_anoeee\_user/\_mapping/field/LocName?pretty=true'

{  
"clfb\_anoeee\_user" : {  
"mappings" : {  
"clfb\_anoeee" : {  
"LocName" : {  
"full\_name" : "LocName",  
"mapping":{"LocName":{"type":"string"}}  
}  
}  
}  
}  
}

But if I create this one:

curl -XPUT 'localhost:9200/test'

curl -XPUT 'localhost:9200/test/test/\_mapping' -d '{  
"properties":{ "LocName":{ "type":"string", "index": "analyzed",  
"analyzer": "nodelim" } } '

Tnis is the mapping that ES reports having created:

curl -XGET 'localhost:9200/test/\_mapping/field/LocName?pretty=true'

{  
"test" : {  
"mappings" : {  
"test" : {  
"LocName" : {  
"full\_name" : "LocName",  
"mapping":{"LocName":{"type":"string","analyzer":"nodelim"}}  
}  
}  
}  
}  
}

So it recognizes the analyzer in the type mapping.

This analyzer "nodelim" is defined in the yml and works fine when using the  
\_analyze API as in the following example:

curl -XGET  
'localhost:9200/clfb\_anoeee\_user/\_analyze?text=Lisbon,+Portugal&analyzer=nodelim&field=LocName&&pretty=true'

I have already tried specifying it in the index\_settings property but  
results were the same.

Do I need to set some other property? Is there any inconsistency here?

I have other fields being mapped with analyzers that are working. But these  
are of another data type (date and long).

Thank you for all your work!

```
   André

```

--  
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/987d5ec6-568a-43a2-b385-ee608a14365e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/987d5ec6-568a-43a2-b385-ee608a14365e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [June 9, 2014, 11:18am UTC](https://discuss.elastic.co/t/jdbc-river-trouble-getting-analyzer-in-type-mapping-to-be-applied/17990/2 "2014-06-09T11:18:46Z")

</div>

There is a bug in the JDBC river introduced recently that prevents it from  
using type\_mapping parameter if there is no index\_settings parameter  
defined.

It will be fixed asap

A work around might be adding an empty settings parameter like

"index\_settings" : {}

Jörg

On Mon, Jun 9, 2014 at 1:00 PM, André Morais [anoeee@gmail.com](mailto:anoeee@gmail.com) wrote:

> Hello!
> 
> I'm creating an index with a JDBC river. In my type mapping I specify  
> an analyzer defined in the YML and working properly. However, it is not  
> applied to the field. When I check its mapping I see that the analyzer  
> specification is not there. If I create a similar index directly on ES it  
> works fine and appears in the mapping. Is there a syntax error somewhere in  
> my river definition or am I missing something here?
> 
> Here is my JDBC river definition:
> 
> {  
> "type": "jdbc",  
> "jdbc": {  
> "driver": "com.mysql.jdbc.Driver",  
> "url": "jdbc:mysql://localhost:3306/clfb\_anoeee\_user",  
> "user": "A",  
> "password": "B",  
> "sql": "select \* from vw\_IndexedUsers",  
> "strategy": "oneshot",  
> "index": "clfb\_anoeee\_user",  
> "type": "clfb\_anoeee",  
> "type\_mapping": "{ "clfb\_anoeee": { "properties":{ "LocName":{  
> "type":"string", "index": "analyzed", "analyzer": "nodelim" } }  
> } }"  
> }  
> }
> 
> And here is the mapping that ES reports having created:
> 
> curl -XGET  
> 'localhost:9200/clfb\_anoeee\_user/\_mapping/field/LocName?pretty=true'
> 
> {  
> "clfb\_anoeee\_user" : {  
> "mappings" : {  
> "clfb\_anoeee" : {  
> "LocName" : {  
> "full\_name" : "LocName",  
> "mapping":{"LocName":{"type":"string"}}  
> }  
> }  
> }  
> }  
> }
> 
> But if I create this one:
> 
> curl -XPUT 'localhost:9200/test'
> 
> curl -XPUT 'localhost:9200/test/test/\_mapping' -d '{  
> "properties":{ "LocName":{ "type":"string", "index": "analyzed",  
> "analyzer": "nodelim" } } '
> 
> Tnis is the mapping that ES reports having created:
> 
> curl -XGET 'localhost:9200/test/\_mapping/field/LocName?pretty=true'
> 
> {  
> "test" : {  
> "mappings" : {  
> "test" : {  
> "LocName" : {  
> "full\_name" : "LocName",  
> "mapping":{"LocName":{"type":"string","analyzer":"nodelim"}}  
> }  
> }  
> }  
> }  
> }
> 
> So it recognizes the analyzer in the type mapping.
> 
> This analyzer "nodelim" is defined in the yml and works fine when using  
> the \_analyze API as in the following example:
> 
> curl -XGET  
> 'localhost:9200/clfb\_anoeee\_user/\_analyze?text=Lisbon,+Portugal&analyzer=nodelim&field=LocName&&pretty=true'
> 
> I have already tried specifying it in the index\_settings property but  
> results were the same.
> 
> Do I need to set some other property? Is there any inconsistency here?
> 
> I have other fields being mapped with analyzers that are working. But  
> these are of another data type (date and long).
> 
> Thank you for all your work!
> 
> ```
> André
> 
> ```
> 
> --  
> 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/987d5ec6-568a-43a2-b385-ee608a14365e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/987d5ec6-568a-43a2-b385-ee608a14365e%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/987d5ec6-568a-43a2-b385-ee608a14365e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/987d5ec6-568a-43a2-b385-ee608a14365e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAKdsXoGLUG610zLCEKcwQGaOYYjqKjVA%2BpBuFUTok5-q8qDF3Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGLUG610zLCEKcwQGaOYYjqKjVA%2BpBuFUTok5-q8qDF3Q%40mail.gmail.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, 1:23am UTC](https://discuss.elastic.co/t/jdbc-river-trouble-getting-analyzer-in-type-mapping-to-be-applied/17990/3 "2017-07-06T01:23:50Z")

</div>


