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

**URL:** <https://discuss.elastic.co/t/error-message-trying-to-serialize-a-value-with-no-field-associated-with-it-current-value/7067>\
**Category:** Elasticsearch\
**Created:** [March 20, 2012, 9:08am UTC](https://discuss.elastic.co/t/error-message-trying-to-serialize-a-value-with-no-field-associated-with-it-current-value/7067 "2012-03-20T09:08:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![posejavier](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@posejavier](https://discuss.elastic.co/u/posejavier)\
**Post date:** [March 20, 2012, 9:08am UTC](https://discuss.elastic.co/t/error-message-trying-to-serialize-a-value-with-no-field-associated-with-it-current-value/7067/1 "2012-03-20T09:08:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 20, 2012, 8:20pm UTC](https://discuss.elastic.co/t/error-message-trying-to-serialize-a-value-with-no-field-associated-with-it-current-value/7067/2 "2012-03-20T20:20:27Z")

</div>

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](mailto: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](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](http://Nabble.com).

---

<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, 3:35am UTC](https://discuss.elastic.co/t/error-message-trying-to-serialize-a-value-with-no-field-associated-with-it-current-value/7067/3 "2017-07-06T03:35:24Z")

</div>


