# Reindexing data problem in river porcess

**URL:** <https://discuss.elastic.co/t/reindexing-data-problem-in-river-porcess/13068>\
**Category:** Elasticsearch\
**Created:** [August 5, 2013, 8:10am UTC](https://discuss.elastic.co/t/reindexing-data-problem-in-river-porcess/13068 "2013-08-05T08:10:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carlos\_Soria](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Carlos\_Soria](https://discuss.elastic.co/u/Carlos_Soria)\
**Post date:** [August 5, 2013, 8:10am UTC](https://discuss.elastic.co/t/reindexing-data-problem-in-river-porcess/13068/1 "2013-08-05T08:10:56Z")

</div>

Hi all,

In our test enviroment we have a cluster with three nodes, one master \*no \*data  
node in machine A, and two data nodes (configured as no-master) in machines  
B and C.

We have an incremental river process in order to synchronize data from a  
data base in ES. The reindexing process does it in two steps:

1- Delete if exists. Find the \_id of the record that has been changed and  
delete it

2- Add the new record recovered from the data base which has been changed

When this process deletes and tries to reindex, we get the next exception:

[2013-07-30 17:11:07,199][DEBUG][action.search.type] [ES-NODE1]  
[319] Failed to execute query phase

org.elasticsearch.transport.SendRequestTransportException:  
[ES-NODE2][inet[/10.136.56.56:9300]][search/phase/query/id]

```
    at 

```

org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:199)

```
    at 

```

org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:171)

```
    at 

```

org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:181)

```
    at 

```

org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.executeQuery(TransportSearchDfsQueryThenFetchAction.java:148)

```
    at 

```

org.elasticsearch.action.search.type.TransportSearchDfsQueryThenFetchAction$AsyncAction.moveToSecondPhase(TransportSearchDfsQueryThenFetchAction.java:107)

```
    at 

```

org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:229)

```
    at 

```

org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onResult(TransportSearchTypeAction.java:208)

```
    at 

```

org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$3.onResult(TransportSearchTypeAction.java:205)

```
    at 

```

org.elasticsearch.search.action.SearchServiceTransportAction$1.handleResponse(SearchServiceTransportAction.java:122)

```
    at 

```

org.elasticsearch.search.action.SearchServiceTransportAction$1.handleResponse(SearchServiceTransportAction.java:113)

```
    at 

```

org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:156)

```
    at 

```

org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:127)

```
    at 

```

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)

```
    at 

```

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)

```
    at 

```

org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)

```
    at 

```

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)

```
    at 

```

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)

```
    at 

```

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)

```
    at 

```

org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)

```
    at 

```

org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)

```
    at 

```

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)

```
    at 

```

org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)

```
    at 

```

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)

```
    at 

```

org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)

```
    at 

```

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)

```
    at 

```

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107)

```
    at 

```

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)

```
    at 

```

org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)

```
    at 

```

org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)

```
    at 

```

org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)

```
    at 

```

org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

```
    at 

```

java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)

```
    at 

```

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)

```
    at java.lang.Thread.run(Thread.java:662)

```

Caused by: java.lang.NullPointerException

```
    at 

```

org.elasticsearch.common.io.stream.HandlesStreamOutput.writeString(HandlesStreamOutput.java:55)

```
    at 

```

org.elasticsearch.search.dfs.AggregatedDfs.writeTo(AggregatedDfs.java:106)

```
    at 

```

org.elasticsearch.search.query.QuerySearchRequest.writeTo(QuerySearchRequest.java:69)

```
    at 

```

org.elasticsearch.transport.netty.NettyTransport.sendRequest(NettyTransport.java:546)

```
    at 

```

org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:184)

```
    ... 33 more

```

Here is the code of the process:

```
            // idDoc is the field used like _id, especified with: 

            // "_id": {

            // "path": "Identifier"

            // }

            //doc is the map with the record data

```

String identifier = doc.get(IDENTIFIER);

//Delete if exists

SearchResponse sResponse = client.prepareSearch(this.index)

.setTypes(docType)

.setSearchType(SearchType.DFS\_QUERY\_THEN\_FETCH)

.setQuery(QueryBuilders.termQuery(idDoc, identifier))

.execute().actionGet();

if (sResponse != null) {

Iterator iterator = sResponse.getHits().iterator();

if (iterator.hasNext()) {

SearchHit sh = iterator.next();

DeleteResponse dr = client.prepareDelete(this.index, this.docType,  
sh.getId()).execute().actionGet();

}

}

//Add the new doc

client.prepareIndex(this.index, this.docType,  
null).setSource(doc).execute().actionGet();

I don´t know what the problem might be. It seems the comunication between  
nodes and nothing to do with our implementation.

Any help? Thanks in advance,

Carlos.

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [August 5, 2013, 12:26pm UTC](https://discuss.elastic.co/t/reindexing-data-problem-in-river-porcess/13068/2 "2013-08-05T12:26:55Z")

</div>

The problem is that you passed a `null` value to the  
`client.prepareIndex` method for the index. There is a missing guard in  
the code, so the error message is somewhat cryptic.

Jörg

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![brian\_yoder](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@brian\_yoder](https://discuss.elastic.co/u/brian_yoder)\
**Post date:** [August 6, 2013, 9:41pm UTC](https://discuss.elastic.co/t/reindexing-data-problem-in-river-porcess/13068/3 "2013-08-06T21:41:48Z")

</div>

I believe that the null value for the null value of the \_id is OK if the  
IndexRequest.OpType.CREATE value is also passed to the \*  
IndexRequestBuilder.setOpType\* method? Not sure which is the default OpType  
though.

A non-null id is required for an INDEX op type; it's optional for a CREATE  
op type.

Brian

On Monday, August 5, 2013 8:26:55 AM UTC-4, Jörg Prante wrote:

> The problem is that you passed a `null` value to the  
> `client.prepareIndex` method for the index. There is a missing guard in  
> the code, so the error message is somewhat cryptic.
> 
> Jörg

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:22am UTC](https://discuss.elastic.co/t/reindexing-data-problem-in-river-porcess/13068/4 "2017-07-06T02:22:36Z")

</div>

Closed on July 6, 2017, 2:22am UTC


