Error Message: trying to serialize a value with no field associated with it, current value


(posejavier) #1

Hello everybody,
this is a problem I am trying to solve already for some time and I didn't find still a solution.
I have a database ("database1") where I have defined the following index using elasticsearch:

curl -XPUT 'localhost:9200/_river/database1_elasticindex/_meta' -d '{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "database1",
"filter" : null
}
}'

The problem appears when I try to insert in the database the following document:

{
"_id": "b2a46244c722ec7a09a8f4811b0006ca",
"childNodes": [
{
"childNodesa": [
{
"childNodess": [
{
"childNodesd": [
"AR"
]
}
]
}
]
},
{
"childNodesa": [
{
"childNodess": [
127
]
}
]
}
]
}

...then, the elasticsearch gives the following error:


[2012-03-20 09:57:16,000][DEBUG][action.bulk ] [Goldbug] [database1
][4] failed to bulk item (index) index {[database1][database1][b2a46244c722ec7a0 9a8f4811b0006ca], source[{"_rev":"1-1d84aa6e123085defdd100bffc63b803","_id":"b2a
46244c722ec7a09a8f4811b0006ca","childNodes":[{"childNodesa":[{"childNodess":[{"c
hildNodesd":["AR"]}]}]},{"childNodesa":[{"childNodess":[127]}]}]}]}
org.elasticsearch.index.mapper.MapperParsingException: object mapping [childNode
ss] trying to serialize a value with no field associated with it, current value
[127]
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(Obj
ectMapper.java:573)
at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper
.java:443)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(Obj
ectMapper.java:577)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(Obj
ectMapper.java:565)
at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper
.java:435)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeObject(Ob
jectMapper.java:491)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(Obj
ectMapper.java:557)
at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper
.java:435)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeObject(Ob
jectMapper.java:491)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(Obj
ectMapper.java:557)
at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper
.java:435)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.ja
va:465)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.ja
va:414)
at org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex
(InternalIndexShard.java:302)
at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperation
OnPrimary(TransportShardBulkAction.java:136)
at org.elasticsearch.action.support.replication.TransportShardReplicatio
nOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplic
ationOperationAction.java:487)
at org.elasticsearch.action.support.replication.TransportShardReplicatio
nOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperat
ionAction.java:400)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
[2012-03-20 09:57:16,014][WARN ][river.couchdb ] [Goldbug] [couchdb][
database1_elasticindex] failed to executefailure in bulk execution:
[0]: index [database1], type [database1], id [b2a46244c722ec7a09a8f4811b0006ca],
message [MapperParsingException[object mapping [childNodess] trying to serializ
e a value with no field associated with it, current value [127]]]
[2012-03-20 09:57:16,016][INFO ][cluster.metadata ] [Goldbug] [_river] u
pdate_mapping [database1_elasticindex] (dynamic)

I understand that this error appears because the field childNodess, first have an object (" childNodesd")associated to it and latter on has a value (127) associated to it.
So it seems that elasticsearch expects that always the fields have the same value type associated to it.

QUESTION: is there any solution to allow elasticsearch to manage documents like this without giving an error?

Many thanks in advance (I would appreciate ANY suggestion or help !!).

J.


(Shay Banon) #2

This problem usually happens when you index a document where a json field
has a value, and then it is an object (or the other way around). You can't
do that with elasticsearch, since mapping is derived based on the first
introduction of a document.

On Tue, Mar 20, 2012 at 11:08 AM, posejavier posejavier@hotmail.com wrote:

Hello everybody,
this is a problem I am trying to solve already for some time and I didn't
find still a solution.
I have a database ("database1") where I have defined the following index
using elasticsearch:

curl -XPUT 'localhost:9200/_river/database1_elasticindex/_meta' -d '{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "database1",
"filter" : null
}
}'

The problem appears when I try to insert in the database the following
document:

{
"_id": "b2a46244c722ec7a09a8f4811b0006ca",
"childNodes": [
{
"childNodesa": [
{
"childNodess": [
{
"childNodesd": [
"AR"
]
}
]
}
]
},
{
"childNodesa": [
{
"childNodess": [
127
]
}
]
}
]
}

...then, the elasticsearch gives the following error:


[2012-03-20 09:57:16,000][DEBUG][action.bulk ] [Goldbug]
[database1
][4] failed to bulk item (index) index
{[database1][database1][b2a46244c722ec7a0 9a8f4811b0006ca],
source[{"_rev":"1-1d84aa6e123085defdd100bffc63b803","_id":"b2a

46244c722ec7a09a8f4811b0006ca","childNodes":[{"childNodesa":[{"childNodess":[{"c
hildNodesd":["AR"]}]}]},{"childNodesa":[{"childNodess":[127]}]}]}]}
org.elasticsearch.index.mapper.MapperParsingException: object mapping
[childNode
ss] trying to serialize a value with no field associated with it, current
value
[127]
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(Obj
ectMapper.java:573)
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper
.java:443)
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(Obj
ectMapper.java:577)
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(Obj
ectMapper.java:565)
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper
.java:435)
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeObject(Ob
jectMapper.java:491)
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(Obj
ectMapper.java:557)
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper
.java:435)
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeObject(Ob
jectMapper.java:491)
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(Obj
ectMapper.java:557)
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper
.java:435)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.ja
va:465)
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.ja
va:414)
at
org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex
(InternalIndexShard.java:302)
at
org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperation
OnPrimary(TransportShardBulkAction.java:136)
at
org.elasticsearch.action.support.replication.TransportShardReplicatio

nOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplic
ationOperationAction.java:487)
at
org.elasticsearch.action.support.replication.TransportShardReplicatio

nOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperat
ionAction.java:400)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
at java.lang.Thread.run(Unknown Source)
[2012-03-20 09:57:16,014][WARN ][river.couchdb ] [Goldbug]
[couchdb][
database1_elasticindex] failed to executefailure in bulk execution:
[0]: index [database1], type [database1], id
[b2a46244c722ec7a09a8f4811b0006ca],
message [MapperParsingException[object mapping [childNodess] trying to
serializ
e a value with no field associated with it, current value [127]]]
[2012-03-20 09:57:16,016][INFO ][cluster.metadata ] [Goldbug]
[_river] u
pdate_mapping [database1_elasticindex] (dynamic)


I understand that this error appears because the field childNodess, first
have an object (" childNodesd")associated to it and latter on has a value
(127) associated to it.
So it seems that elasticsearch expects that always the fields have the same
value type associated to it.

QUESTION: is there any solution to allow elasticsearch to manage documents
like this without giving an error?

Many thanks in advance (I would appreciate ANY suggestion or help !!).

J.

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Error-Message-trying-to-serialize-a-value-with-no-field-associated-with-it-current-value-tp3841784p3841784.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(system) #3