# NPE in Couch River dynamic mapping

**URL:** <https://discuss.elastic.co/t/npe-in-couch-river-dynamic-mapping/5169>\
**Category:** Elasticsearch\
**Created:** [August 16, 2011, 9:18am UTC](https://discuss.elastic.co/t/npe-in-couch-river-dynamic-mapping/5169 "2011-08-16T09:18:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Rees](https://avatars.discourse-cdn.com/v4/letter/r/7ab992/32.png) [@Robert\_Rees](https://discuss.elastic.co/u/Robert_Rees)\
**Post date:** [August 16, 2011, 9:18am UTC](https://discuss.elastic.co/t/npe-in-couch-river-dynamic-mapping/5169/1 "2011-08-16T09:18:01Z")

</div>

Hi there, I am trying to move to ES 0.17.6 and I am getting a lot of  
the stack traces below when using the CouchDB River with a default  
mapping. Effectively nothing is getting indexed and I'm not sure how  
to proceed. Any suggestions where to look for the problem?

java.lang.NullPointerException  
at org.elasticsearch.index.mapper.FieldMapper  
$Names.(FieldMapper.java:55)  
at org.elasticsearch.index.mapper.core.AbstractFieldMapper  
$Builder.buildNames(AbstractFieldMapper.java:186)  
at org.elasticsearch.index.mapper.core.StringFieldMapper  
$Builder.build(StringFieldMapper.java:73)  
at org.elasticsearch.index.mapper.core.StringFieldMapper  
$Builder.build(StringFieldMapper.java:53)  
at  
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
632)  
at  
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
440)  
at  
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
565)  
at  
org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(ObjectMapper.java:  
556)  
at  
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
432)  
at  
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
566)  
at  
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
490)  
at  
org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:  
289)  
at  
org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:  
130)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction  
$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:  
428)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction  
$AsyncShardOperationAction  
$1.run(TransportShardReplicationOperationAction.java:341)  
at  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:  
1110)  
at java.util.concurrent.ThreadPoolExecutor  
$Worker.run(ThreadPoolExecutor.java:603)  
at java.lang.Thread.run(Thread.java:636)

---

<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:** [August 16, 2011, 11:04am UTC](https://discuss.elastic.co/t/npe-in-couch-river-dynamic-mapping/5169/2 "2011-08-16T11:04:17Z")

</div>

Can you try and recreate it with the sample data you index using curl, and  
gist it?

On Tue, Aug 16, 2011 at 12:18 PM, Robert Rees [robert@wazoku.com](mailto:robert@wazoku.com) wrote:

> Hi there, I am trying to move to ES 0.17.6 and I am getting a lot of  
> the stack traces below when using the CouchDB River with a default  
> mapping. Effectively nothing is getting indexed and I'm not sure how  
> to proceed. Any suggestions where to look for the problem?
> 
> java.lang.NullPointerException  
> at org.elasticsearch.index.mapper.FieldMapper  
> $Names.(FieldMapper.java:55)  
> at org.elasticsearch.index.mapper.core.AbstractFieldMapper  
> $Builder.buildNames(AbstractFieldMapper.java:186)  
> at org.elasticsearch.index.mapper.core.StringFieldMapper  
> $Builder.build(StringFieldMapper.java:73)  
> at org.elasticsearch.index.mapper.core.StringFieldMapper  
> $Builder.build(StringFieldMapper.java:53)  
> at
> 
> org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
> 632)  
> at  
> org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
> 440)  
> at
> 
> org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
> 565)  
> at
> 
> org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(ObjectMapper.java:  
> 556)  
> at  
> org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
> 432)  
> at  
> org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
> 566)  
> at  
> org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
> 490)  
> at
> 
> org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:  
> 289)  
> at
> 
> org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:  
> 130)  
> at
> 
> org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
> 
> $AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:  
> 428)  
> at
> 
> org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction  
> $AsyncShardOperationAction  
> $1.run(TransportShardReplicationOperationAction.java:341)  
> at  
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:  
> 1110)  
> at java.util.concurrent.ThreadPoolExecutor  
> $Worker.run(ThreadPoolExecutor.java:603)  
> at java.lang.Thread.run(Thread.java:636)

---

<div class="post-metadata">

**Author:** ![Robert\_Rees](https://avatars.discourse-cdn.com/v4/letter/r/7ab992/32.png) [@Robert\_Rees](https://discuss.elastic.co/u/Robert_Rees)\
**Post date:** [August 16, 2011, 12:46pm UTC](https://discuss.elastic.co/t/npe-in-couch-river-dynamic-mapping/5169/3 "2011-08-16T12:46:13Z")

</div>

I have found the problem field (nothing more sophisticated than removing  
fields until the problem went away). I think I know the cause of the problem  
now. This field is an array that can contain either a map or a string.  
Historic records hold maps and newer ones contain strings. Intermediates can  
contain both. If I include this field I get the error, if I don't it indexes  
okay. I assumed it would be okay as it is valid JSON going in but are there  
some rules around mixed types in collections?

On Tue, Aug 16, 2011 at 12:04 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Can you try and recreate it with the sample data you index using curl, and  
> gist it?
> 
> On Tue, Aug 16, 2011 at 12:18 PM, Robert Rees [robert@wazoku.com](mailto:robert@wazoku.com) wrote:
> 
> > Hi there, I am trying to move to ES 0.17.6 and I am getting a lot of  
> > the stack traces below when using the CouchDB River with a default  
> > mapping. Effectively nothing is getting indexed and I'm not sure how  
> > to proceed. Any suggestions where to look for the problem?
> > 
> > java.lang.NullPointerException  
> > at org.elasticsearch.index.mapper.FieldMapper  
> > $Names.(FieldMapper.java:55)  
> > at org.elasticsearch.index.mapper.core.AbstractFieldMapper  
> > $Builder.buildNames(AbstractFieldMapper.java:186)  
> > at org.elasticsearch.index.mapper.core.StringFieldMapper  
> > $Builder.build(StringFieldMapper.java:73)  
> > at org.elasticsearch.index.mapper.core.StringFieldMapper  
> > $Builder.build(StringFieldMapper.java:53)  
> > at
> > 
> > org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
> > 632)  
> > at
> > 
> > org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
> > 440)  
> > at
> > 
> > org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
> > 565)  
> > at
> > 
> > org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(ObjectMapper.java:  
> > 556)  
> > at
> > 
> > org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
> > 432)  
> > at  
> > org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
> > 566)  
> > at  
> > org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
> > 490)  
> > at
> > 
> > org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:  
> > 289)  
> > at
> > 
> > org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:  
> > 130)  
> > at
> > 
> > org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
> > 
> > $AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:  
> > 428)  
> > at
> > 
> > org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction  
> > $AsyncShardOperationAction  
> > $1.run(TransportShardReplicationOperationAction.java:341)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:  
> > 1110)  
> > at java.util.concurrent.ThreadPoolExecutor  
> > $Worker.run(ThreadPoolExecutor.java:603)  
> > at java.lang.Thread.run(Thread.java:636)

---

<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:** [August 16, 2011, 12:49pm UTC](https://discuss.elastic.co/t/npe-in-couch-river-dynamic-mapping/5169/4 "2011-08-16T12:49:47Z")

</div>

Yes, there are. Once you index a specific json, mapping is created for it.  
So, for example, a field can't be type "string", and then become an object.  
This is because we need to index them in a specific manner, and know how to  
work with them when searching.

On Tue, Aug 16, 2011 at 3:46 PM, Robert Rees [robert@wazoku.com](mailto:robert@wazoku.com) wrote:

> I have found the problem field (nothing more sophisticated than removing  
> fields until the problem went away). I think I know the cause of the problem  
> now. This field is an array that can contain either a map or a string.  
> Historic records hold maps and newer ones contain strings. Intermediates can  
> contain both. If I include this field I get the error, if I don't it indexes  
> okay. I assumed it would be okay as it is valid JSON going in but are there  
> some rules around mixed types in collections?
> 
> On Tue, Aug 16, 2011 at 12:04 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > Can you try and recreate it with the sample data you index using curl, and  
> > gist it?
> > 
> > On Tue, Aug 16, 2011 at 12:18 PM, Robert Rees [robert@wazoku.com](mailto:robert@wazoku.com) wrote:
> > 
> > > Hi there, I am trying to move to ES 0.17.6 and I am getting a lot of  
> > > the stack traces below when using the CouchDB River with a default  
> > > mapping. Effectively nothing is getting indexed and I'm not sure how  
> > > to proceed. Any suggestions where to look for the problem?
> > > 
> > > java.lang.NullPointerException  
> > > at org.elasticsearch.index.mapper.FieldMapper  
> > > $Names.(FieldMapper.java:55)  
> > > at org.elasticsearch.index.mapper.core.AbstractFieldMapper  
> > > $Builder.buildNames(AbstractFieldMapper.java:186)  
> > > at org.elasticsearch.index.mapper.core.StringFieldMapper  
> > > $Builder.build(StringFieldMapper.java:73)  
> > > at org.elasticsearch.index.mapper.core.StringFieldMapper  
> > > $Builder.build(StringFieldMapper.java:53)  
> > > at
> > > 
> > > org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
> > > 632)  
> > > at
> > > 
> > > org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
> > > 440)  
> > > at
> > > 
> > > org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
> > > 565)  
> > > at
> > > 
> > > org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(ObjectMapper.java:  
> > > 556)  
> > > at
> > > 
> > > org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
> > > 432)  
> > > at  
> > > org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
> > > 566)  
> > > at  
> > > org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
> > > 490)  
> > > at
> > > 
> > > org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:  
> > > 289)  
> > > at
> > > 
> > > org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:  
> > > 130)  
> > > at
> > > 
> > > org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
> > > 
> > > $AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:  
> > > 428)  
> > > at
> > > 
> > > org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction  
> > > $AsyncShardOperationAction  
> > > $1.run(TransportShardReplicationOperationAction.java:341)  
> > > at
> > > 
> > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:  
> > > 1110)  
> > > at java.util.concurrent.ThreadPoolExecutor  
> > > $Worker.run(ThreadPoolExecutor.java:603)  
> > > at java.lang.Thread.run(Thread.java:636)

---

<div class="post-metadata">

**Author:** ![Robert\_Rees](https://avatars.discourse-cdn.com/v4/letter/r/7ab992/32.png) [@Robert\_Rees](https://discuss.elastic.co/u/Robert_Rees)\
**Post date:** [August 16, 2011, 12:58pm UTC](https://discuss.elastic.co/t/npe-in-couch-river-dynamic-mapping/5169/5 "2011-08-16T12:58:07Z")

</div>

To help me be clear about sorting this out. Arrays to be indexed must only  
contain one type? If I migrate the array to contain only objects I can then  
delete the rivers and recreate them to rebuild the inferred schema?

On Tue, Aug 16, 2011 at 3:46 PM, Robert Rees [robert@wazoku.com](mailto:robert@wazoku.com) wrote:

> > I have found the problem field (nothing more sophisticated than removing  
> > fields until the problem went away). I think I know the cause of the problem  
> > now. This field is an array that can contain either a map or a string.  
> > Historic records hold maps and newer ones contain strings. Intermediates can  
> > contain both. If I include this field I get the error, if I don't it indexes  
> > okay. I assumed it would be okay as it is valid JSON going in but are there  
> > some rules around mixed types in collections?
> > 
> > On Tue, Aug 16, 2011 at 12:04 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > 
> > > Can you try and recreate it with the sample data you index using curl,  
> > > and gist it?
> > > 
> > > On Tue, Aug 16, 2011 at 12:18 PM, Robert Rees [robert@wazoku.com](mailto:robert@wazoku.com) wrote:
> > > 
> > > > Hi there, I am trying to move to ES 0.17.6 and I am getting a lot of  
> > > > the stack traces below when using the CouchDB River with a default  
> > > > mapping. Effectively nothing is getting indexed and I'm not sure how  
> > > > to proceed. Any suggestions where to look for the problem?
> > > > 
> > > > java.lang.NullPointerException  
> > > > at org.elasticsearch.index.mapper.FieldMapper  
> > > > $Names.(FieldMapper.java:55)  
> > > > at org.elasticsearch.index.mapper.core.AbstractFieldMapper  
> > > > $Builder.buildNames(AbstractFieldMapper.java:186)  
> > > > at org.elasticsearch.index.mapper.core.StringFieldMapper  
> > > > $Builder.build(StringFieldMapper.java:73)  
> > > > at org.elasticsearch.index.mapper.core.StringFieldMapper  
> > > > $Builder.build(StringFieldMapper.java:53)  
> > > > at
> > > > 
> > > > org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
> > > > 632)  
> > > > at
> > > > 
> > > > org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
> > > > 440)  
> > > > at
> > > > 
> > > > org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
> > > > 565)  
> > > > at
> > > > 
> > > > org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(ObjectMapper.java:  
> > > > 556)  
> > > > at
> > > > 
> > > > org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
> > > > 432)  
> > > > at  
> > > > org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
> > > > 566)  
> > > > at  
> > > > org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
> > > > 490)  
> > > > at
> > > > 
> > > > org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:  
> > > > 289)  
> > > > at
> > > > 
> > > > org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:  
> > > > 130)  
> > > > at
> > > > 
> > > > org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
> > > > 
> > > > $AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:  
> > > > 428)  
> > > > at
> > > > 
> > > > org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction  
> > > > $AsyncShardOperationAction  
> > > > $1.run(TransportShardReplicationOperationAction.java:341)  
> > > > at
> > > > 
> > > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:  
> > > > 1110)  
> > > > at java.util.concurrent.ThreadPoolExecutor  
> > > > $Worker.run(ThreadPoolExecutor.java:603)  
> > > > at java.lang.Thread.run(Thread.java:636)

---

<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:** [August 16, 2011, 1:21pm UTC](https://discuss.elastic.co/t/npe-in-couch-river-dynamic-mapping/5169/6 "2011-08-16T13:21:36Z")

</div>

Yes, you can do that. Note that deleting the rivers just delete the river,  
not the index its indexes into. So, you can potentially simply delete one  
river, keep the old index, and then create a new river that would index into  
a different index.

On Tue, Aug 16, 2011 at 3:58 PM, Robert Rees [robert@wazoku.com](mailto:robert@wazoku.com) wrote:

> To help me be clear about sorting this out. Arrays to be indexed must only  
> contain one type? If I migrate the array to contain only objects I can then  
> delete the rivers and recreate them to rebuild the inferred schema?
> 
> On Tue, Aug 16, 2011 at 3:46 PM, Robert Rees [robert@wazoku.com](mailto:robert@wazoku.com) wrote:
> 
> > > I have found the problem field (nothing more sophisticated than removing  
> > > fields until the problem went away). I think I know the cause of the problem  
> > > now. This field is an array that can contain either a map or a string.  
> > > Historic records hold maps and newer ones contain strings. Intermediates can  
> > > contain both. If I include this field I get the error, if I don't it indexes  
> > > okay. I assumed it would be okay as it is valid JSON going in but are there  
> > > some rules around mixed types in collections?
> > > 
> > > On Tue, Aug 16, 2011 at 12:04 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > 
> > > > Can you try and recreate it with the sample data you index using curl,  
> > > > and gist it?
> > > > 
> > > > On Tue, Aug 16, 2011 at 12:18 PM, Robert Rees [robert@wazoku.com](mailto:robert@wazoku.com)wrote:
> > > > 
> > > > > Hi there, I am trying to move to ES 0.17.6 and I am getting a lot of  
> > > > > the stack traces below when using the CouchDB River with a default  
> > > > > mapping. Effectively nothing is getting indexed and I'm not sure how  
> > > > > to proceed. Any suggestions where to look for the problem?
> > > > > 
> > > > > java.lang.NullPointerException  
> > > > > at org.elasticsearch.index.mapper.FieldMapper  
> > > > > $Names.(FieldMapper.java:55)  
> > > > > at org.elasticsearch.index.mapper.core.AbstractFieldMapper  
> > > > > $Builder.buildNames(AbstractFieldMapper.java:186)  
> > > > > at org.elasticsearch.index.mapper.core.StringFieldMapper  
> > > > > $Builder.build(StringFieldMapper.java:73)  
> > > > > at org.elasticsearch.index.mapper.core.StringFieldMapper  
> > > > > $Builder.build(StringFieldMapper.java:53)  
> > > > > at
> > > > > 
> > > > > org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
> > > > > 632)  
> > > > > at
> > > > > 
> > > > > org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
> > > > > 440)  
> > > > > at
> > > > > 
> > > > > org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
> > > > > 565)  
> > > > > at
> > > > > 
> > > > > org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(ObjectMapper.java:  
> > > > > 556)  
> > > > > at
> > > > > 
> > > > > org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
> > > > > 432)  
> > > > > at
> > > > > 
> > > > > org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
> > > > > 566)  
> > > > > at
> > > > > 
> > > > > org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
> > > > > 490)  
> > > > > at
> > > > > 
> > > > > org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:  
> > > > > 289)  
> > > > > at
> > > > > 
> > > > > org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:  
> > > > > 130)  
> > > > > at
> > > > > 
> > > > > org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
> > > > > 
> > > > > $AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:  
> > > > > 428)  
> > > > > at
> > > > > 
> > > > > org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction  
> > > > > $AsyncShardOperationAction  
> > > > > $1.run(TransportShardReplicationOperationAction.java:341)  
> > > > > at
> > > > > 
> > > > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:  
> > > > > 1110)  
> > > > > at java.util.concurrent.ThreadPoolExecutor  
> > > > > $Worker.run(ThreadPoolExecutor.java:603)  
> > > > > at java.lang.Thread.run(Thread.java:636)

---

<div class="post-metadata">

**Author:** ![Robert\_Rees](https://avatars.discourse-cdn.com/v4/letter/r/7ab992/32.png) [@Robert\_Rees](https://discuss.elastic.co/u/Robert_Rees)\
**Post date:** [August 16, 2011, 4:51pm UTC](https://discuss.elastic.co/t/npe-in-couch-river-dynamic-mapping/5169/7 "2011-08-16T16:51:01Z")

</div>

Here's the simplest example I could think of to exercise the problem.

curl -XPUT [http://localhost:9200/test-index/hetro-array/1](http://localhost:9200/test-index/hetro-array/1) -d '{"tracer" :  
"dummy", "values" : [{"fruit" : "lemon"}]}'  
curl [http://localhost:9200/test-index/hetro-array/\_search?pretty=true](http://localhost:9200/test-index/hetro-array/_search?pretty=true) -d  
'{"query" : {"term" : {"tracer" : "dummy"}}}'  
curl -XPUT [http://localhost:9200/test-index/hetro-array/1](http://localhost:9200/test-index/hetro-array/1) -d '{"tracer" :  
"dummy", "values" : [{"fruit" : "lemon"}, "lime"]}'

The stack trace is the same as my "live" one.

On Tue, Aug 16, 2011 at 2:21 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Yes, you can do that. Note that deleting the rivers just delete the river,  
> not the index its indexes into. So, you can potentially simply delete one  
> river, keep the old index, and then create a new river that would index into  
> a different index.
> 
> On Tue, Aug 16, 2011 at 3:58 PM, Robert Rees [robert@wazoku.com](mailto:robert@wazoku.com) wrote:
> 
> > To help me be clear about sorting this out. Arrays to be indexed must only  
> > contain one type? If I migrate the array to contain only objects I can then  
> > delete the rivers and recreate them to rebuild the inferred schema?
> > 
> > On Tue, Aug 16, 2011 at 3:46 PM, Robert Rees [robert@wazoku.com](mailto:robert@wazoku.com) wrote:
> > 
> > > > I have found the problem field (nothing more sophisticated than removing  
> > > > fields until the problem went away). I think I know the cause of the problem  
> > > > now. This field is an array that can contain either a map or a string.  
> > > > Historic records hold maps and newer ones contain strings. Intermediates can  
> > > > contain both. If I include this field I get the error, if I don't it indexes  
> > > > okay. I assumed it would be okay as it is valid JSON going in but are there  
> > > > some rules around mixed types in collections?
> > > > 
> > > > On Tue, Aug 16, 2011 at 12:04 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > > 
> > > > > Can you try and recreate it with the sample data you index using curl,  
> > > > > and gist it?
> > > > > 
> > > > > On Tue, Aug 16, 2011 at 12:18 PM, Robert Rees [robert@wazoku.com](mailto:robert@wazoku.com)wrote:
> > > > > 
> > > > > > Hi there, I am trying to move to ES 0.17.6 and I am getting a lot of  
> > > > > > the stack traces below when using the CouchDB River with a default  
> > > > > > mapping. Effectively nothing is getting indexed and I'm not sure how  
> > > > > > to proceed. Any suggestions where to look for the problem?
> > > > > > 
> > > > > > java.lang.NullPointerException  
> > > > > > at org.elasticsearch.index.mapper.FieldMapper  
> > > > > > $Names.(FieldMapper.java:55)  
> > > > > > at org.elasticsearch.index.mapper.core.AbstractFieldMapper  
> > > > > > $Builder.buildNames(AbstractFieldMapper.java:186)  
> > > > > > at org.elasticsearch.index.mapper.core.StringFieldMapper  
> > > > > > $Builder.build(StringFieldMapper.java:73)  
> > > > > > at org.elasticsearch.index.mapper.core.StringFieldMapper  
> > > > > > $Builder.build(StringFieldMapper.java:53)  
> > > > > > at
> > > > > > 
> > > > > > org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
> > > > > > 632)  
> > > > > > at
> > > > > > 
> > > > > > org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
> > > > > > 440)  
> > > > > > at
> > > > > > 
> > > > > > org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:  
> > > > > > 565)  
> > > > > > at
> > > > > > 
> > > > > > org.elasticsearch.index.mapper.object.ObjectMapper.serializeArray(ObjectMapper.java:  
> > > > > > 556)  
> > > > > > at
> > > > > > 
> > > > > > org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:  
> > > > > > 432)  
> > > > > > at
> > > > > > 
> > > > > > org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
> > > > > > 566)  
> > > > > > at
> > > > > > 
> > > > > > org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:  
> > > > > > 490)  
> > > > > > at
> > > > > > 
> > > > > > org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:  
> > > > > > 289)  
> > > > > > at
> > > > > > 
> > > > > > org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:  
> > > > > > 130)  
> > > > > > at
> > > > > > 
> > > > > > org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
> > > > > > 
> > > > > > $AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:  
> > > > > > 428)  
> > > > > > at
> > > > > > 
> > > > > > org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction  
> > > > > > $AsyncShardOperationAction  
> > > > > > $1.run(TransportShardReplicationOperationAction.java:341)  
> > > > > > at
> > > > > > 
> > > > > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:  
> > > > > > 1110)  
> > > > > > at java.util.concurrent.ThreadPoolExecutor  
> > > > > > $Worker.run(ThreadPoolExecutor.java:603)  
> > > > > > at java.lang.Thread.run(Thread.java:636)

---

<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:56am UTC](https://discuss.elastic.co/t/npe-in-couch-river-dynamic-mapping/5169/8 "2017-07-06T03:56:49Z")

</div>


