I am experimenting with custom Action plugins in Elasticsearch 2.4.4 using Java. I'm creating an index with 10000 documents spread out over 5 shards. I am trying to generate a list of documents at the shard level, and then aggregate the result from each shard response. About 90% of the time, I receive at least one failed shard response. 10% of the time all 5 shards return a List to the newResponse method, where I can then aggregate to a single List as expected. I am doing my testing using JUnits integration testing for elasticsearch.
I'm following examples from the Elasticsearch Cookbook to guide me in this task. Any ideas or pointers in debugging my code?