First index document hit fails

We have a cluster with 2 nodes running ES 2.1.0 and we are running a few tests by hitting only one of the nodes. One of the tests tries to index a document before running the actual test. We have seen errors trying to index a document if the server is not hit for a longer period of time. The test uses the pyhton client library to index the document and we are seeing Error indexing document on server:9200/documents with status: N/A as seen below

PUT http://server:9200/documents/document/d94b07f48d6b090245219e5ba1d5a4d1?refresh=true [status:N/A request:10.068s]

The weird part is that the test fails 1st time and then runs without issues. Is there an idle state or some configuration that we are not aware of that could cause this behaviour?

Nope. Check your ES logs, there may be something.

Thanks for the reply, I will have a look through the logs to see if I spot something.

Try to update to 2.1.2. There was fix for long index recreation (delete - create scenario), maybe your trouble related to this somehow.

I have set the log level to DEBUG and this is the error I am getting when indexing a document after a long time of inactivity:

2016-03-21 11:18:31,251 ApplicationName="Elasticsearch" EventSeverity="DEBUG" EventModule="http.netty" EventMessage="[ES-Master-002] Caught exception while handling client http traffic, closing connection [id: 0xa052cf7f, /server:64543 :> /server:9200]" ExceptionMessage="java.nio.channels.ClosedChannelException at org.jboss.netty.channel.socket.nio.AbstractNioWorker.cleanUpWriteBuffer(AbstractNioWorker.java:433)

I have attached a screen capture of the full stack trace.