Here is my code to send the list:
for (int i = 0; i < list.size(); i++) {
request.add(new IndexRequest("myindex", "doc").source(list,XContentType.JSON));
count++;
}
I tried converting the list in form of a map as well but it is creating index and hitting multiple times but not pushing any data :
for (int i = 0; i < list.size(); i++) {
JSONObject dataAsJson = new JSONObject(list);
HashMap<String, Object> dataAsMap = new HashMap<String, Object>(dataAsJson.toMap());
request.add(new IndexRequest("myindex", "doc").source(dataAsMap,XContentType.JSON));
}
Here is the sample data which I am trying to load :
[{"Name" : "ABC",
"Class" : "six",
"Roll" : "330344953 ",
"Team" : "XYX"
},
{"Name" : "AEBC",
"Class" : "six",
"Roll" : "3344953 ",
"Team" : "XYZ"
}]