Update: The logs did not show anything useful. I have even tried the "trace" level.
I have created a fully working example that reproduces the potential bug (don;t forget to substitute cluster.name with your cluster name):
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
public class ESTests {
public static final String INDEX = "tempindex";
public static final int SIZE1 = 3;
public static final int SIZE2 = 3;
public static void main(String[] args) throws Exception {
Client client = new TransportClient(ImmutableSettings.builder().put("cluster.name", "ncluster").build())
.addTransportAddress(new InetSocketTransportAddress("localhost", 9300));
System.out.println("Client initialized.");
try {
//first delete the old index, if exists.
client.admin().indices().delete(new DeleteIndexRequest(INDEX)).actionGet();
System.out.println("Index deleted.");
} catch (ElasticsearchException e) {
//ignore
}
Settings settings = ImmutableSettings.settingsBuilder().build();
System.out.println("Settings built.");
//Then create a new-clean index.
client.admin().indices().create(new CreateIndexRequest(INDEX, settings)).actionGet();
System.out.println("Index created.");
XContentBuilder cb = XContentFactory.jsonBuilder();
int id = 1;
cb.startObject();
cb.field("name", "test document");
{
cb.startArray("testArray");
String str = "";
for(int i = 0; i < SIZE1; i++) str += "0"; //515 does not work!
for(int i = 0; i < SIZE2; i++) {
cb.startObject();
cb.field("counter", i);
cb.field("str", str);
cb.endObject();
}
cb.endArray();
}
cb.endObject();
client.prepareIndex(INDEX, "document", Integer.toString(id)).setSource(cb.string()).execute();
}
}
The above code, should insert a similar document to the one below:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "tempindex",
"_type": "document",
"_id": "1",
"_score": 1,
"_source": {
"name": "test document",
"testArray": [
{
"counter": 0,
"str": "000"
},
{
"counter": 1,
"str": "000"
},
{
"counter": 2,
"str": "000"
}
]
}
}
]
}
}
Now, when I change the constants SIZE1 and SIZE2, to values 100 and 1000 respectively, the document is not being created! You can play with the values to determine when exactly the error occurs.
To retrieve the document, I use the Sense plugin for Chrome and the following command:
POST /tempindex/document/_search?pretty=1
{
"query" : {
"match_all" : {}
}
}
Any Ideas?