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

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/987d5ec6-568a-43a2-b385-ee608a14365e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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 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.
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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGLUG610zLCEKcwQGaOYYjqKjVA%2BpBuFUTok5-q8qDF3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.