NPE for bulk indexing via Java API


(Karussell) #1

Hi,

I got a NPE when doing sth. like this:

    BulkRequestBuilder brb = client.prepareBulk();
        for (SolrTweet tw : tweets) {
            String id = Long.toString(tw.getTwitterId());
            XContentBuilder source = createDoc(tw);

brb.add(Requests.indexRequest(indexName).type(getIndexType()).id(id).source(source));
}
if (brb.numberOfActions() > 0) brb.execute().actionGet();

I didn't properly check if the status was ok or not but no exception
should be thrown ...

Kind Regards,
Peter.

2011-01-27 13:02:02,826 [elasticsearch[Eon][tp]-pool-1-thread-6] WARN
org.elasticsearch.action.bulk - [Eon] Failed to update master on
updated mapping for index [index2], type [tweet]
java.lang.NullPointerException
at
org.elasticsearch.action.bulk.TransportShardBulkAction.updateMappingOnMaster(TransportShardBulkAction.java:
244)
at
org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:
168)
at
org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:
61)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:
421)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.access
$200(TransportShardReplicationOperationAction.java:220)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction
$1.run(TransportShardReplicationOperationAction.java:318)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)


(Shay Banon) #2

I will try and track this down and see why it happens...
On Sunday, January 30, 2011 at 10:20 PM, Karussell wrote:

Hi,

I got a NPE when doing sth. like this:

BulkRequestBuilder brb = client.prepareBulk();
for (SolrTweet tw : tweets) {
String id = Long.toString(tw.getTwitterId());
XContentBuilder source = createDoc(tw);

brb.add(Requests.indexRequest(indexName).type(getIndexType()).id(id).source(source));
}
if (brb.numberOfActions() > 0) brb.execute().actionGet();

I didn't properly check if the status was ok or not but no exception
should be thrown ...

Kind Regards,
Peter.

2011-01-27 13:02:02,826 [elasticsearch[Eon][tp]-pool-1-thread-6] WARN
org.elasticsearch.action.bulk - [Eon] Failed to update master on
updated mapping for index [index2], type [tweet]
java.lang.NullPointerException
at
org.elasticsearch.action.bulk.TransportShardBulkAction.updateMappingOnMaster(TransportShardBulkAction.java:
244)
at
org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:
168)
at
org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:
61)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:
421)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.access
$200(TransportShardReplicationOperationAction.java:220)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction
$1.run(TransportShardReplicationOperationAction.java:318)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)


(Karussell) #3

Thanks

On 30 Jan., 22:19, Shay Banon shay.ba...@elasticsearch.com wrote:

I will try and track this down and see why it happens...

On Sunday, January 30, 2011 at 10:20 PM, Karussell wrote:

Hi,

I got a NPE when doing sth. like this:

BulkRequestBuilder brb = client.prepareBulk();
for (SolrTweet tw : tweets) {
String id = Long.toString(tw.getTwitterId());
XContentBuilder source = createDoc(tw);

brb.add(Requests.indexRequest(indexName).type(getIndexType()).id(id).source(source));
}
if (brb.numberOfActions() > 0) brb.execute().actionGet();

I didn't properly check if the status was ok or not but no exception
should be thrown ...

Kind Regards,
Peter.

2011-01-27 13:02:02,826 [elasticsearch[Eon][tp]-pool-1-thread-6] WARN
org.elasticsearch.action.bulk - [Eon] Failed to update master on
updated mapping for index [index2], type [tweet]
java.lang.NullPointerException
at
org.elasticsearch.action.bulk.TransportShardBulkAction.updateMappingOnMaster(TransportShardBulkAction.java:
244)
at
org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:
168)
at
org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:
61)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:
421)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.access
$200(TransportShardReplicationOperationAction.java:220)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction
$1.run(TransportShardReplicationOperationAction.java:318)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)


(Toby M) #4

Just want to add that I get basically the same error using a standard
(non-bulk) HTTP PUT request. ElasticSearch returns a 200 indicating
the index, type, and dynamic mapping have all been created. However, a
subsequent search or GET for _mapping fails.

200 Response:

{"ok":true,"_index":"myindex","_type":"mytype1","_id":"init"}

ElasticSearch log:

[WARN ][action.index ] [Grey King] Failed to update master
on updated mapping for index [myindex], type [mytype1]
java.lang.NullPointerException
at
org.elasticsearch.action.index.TransportIndexAction.updateMappingOnMaster(TransportIndexAction.java:
201)
at
org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:
176)
at
org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:
66)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:
418)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.access
$200(TransportShardReplicationOperationAction.java:218)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction
$1.run(TransportShardReplicationOperationAction.java:316)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

On Jan 31, 2:16 pm, Karussell tableyourt...@googlemail.com wrote:

Thanks

On 30 Jan., 22:19, Shay Banon shay.ba...@elasticsearch.com wrote:

I will try and track this down and see why it happens...

On Sunday, January 30, 2011 at 10:20 PM, Karussell wrote:

Hi,

I got a NPE when doing sth. like this:

BulkRequestBuilder brb = client.prepareBulk();
for (SolrTweet tw : tweets) {
String id = Long.toString(tw.getTwitterId());
XContentBuilder source = createDoc(tw);

brb.add(Requests.indexRequest(indexName).type(getIndexType()).id(id).source (source));
}
if (brb.numberOfActions() > 0) brb.execute().actionGet();

I didn't properly check if the status was ok or not but no exception
should be thrown ...

Kind Regards,
Peter.

2011-01-27 13:02:02,826 [elasticsearch[Eon][tp]-pool-1-thread-6] WARN
org.elasticsearch.action.bulk - [Eon] Failed to update master on
updated mapping for index [index2], type [tweet]
java.lang.NullPointerException
at
org.elasticsearch.action.bulk.TransportShardBulkAction.updateMappingOnMaste r(TransportShardBulkAction.java:
244)
at
org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrim ary(TransportShardBulkAction.java:
168)
at
org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrim ary(TransportShardBulkAction.java:
61)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOpera tionAction
$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperat ionAction.java:
421)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOpera tionAction
$AsyncShardOperationAction.access
$200(TransportShardReplicationOperationAction.java:220)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOpera tionAction
$AsyncShardOperationAction
$1.run(TransportShardReplicationOperationAction.java:318)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)


(system) #5