Data inconsistency in bulk indexing to ES child index

I'm using ElasticSearch 1.7.5. I have a scenario of bulkindexing to child index. It's been noticed that some data getting missed during the bulkindexing and sometimes data from one bulk instance get merged with another, causing inconsistency.
The sample code I'm using pasting below.

public void writeToChildIndex(List<ClassInfo> classInfoList)  {
	childInfo obj = null;
	BulkRequestBuilder bulkRequestBuilder = null;
	IndexRequestBuilder requestBuilder = null;
	BulkIndexThread bulkIndexThredObj = null;
	try {
		for (ClassInfo classInfo : classInfoList) {
			bulkRequestBuilder = writeClient.prepareBulk(); 

			for (String entryId : classInfo.post_id_set) {
				obj = new TextThemeChildInfo();

				obj.infoId = classInfo.infoId;
				obj.entry_id = entryId;
				obj.category = classInfo.category;

				requestBuilder = writeClient.prepareIndex("index", "child", classInfo.infoId + entryId);
                                    //writeClient is the connection client variable
				requestBuilder.setSource(JSONConverter.toJsonString(obj));//convert POJO to json string
				requestBuilder.setParent(entryId);

				bulkRequestBuilder.add(requestBuilder);
			}
			
			bulkRequestBuilder.execute().actionGet();
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}

Could you find any issue with the code or is there any issue with this ES version?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.