Add multiple data values to Elasticsearch index using java REST API

Hi All,
I am using JAVA REST API to create index and add data to the index.
Below is the code I am using:

Map<String, Object> dataMap = new HashMap<String, Object>();
dataMap.put("appname",  app);
dataMap.put("version",  version);
IndexRequest indexRequest = new IndexRequest("appindex").source(dataMap);
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);

This piece of code works perfectly to create index and add the the dataMap to the index.

My requirement is that I need to iterate over a list of object and add datas to dataMap then add the dataMap to the index.
For instance -

Iterate over a object(){
dataMap.add("key", Value)
dataMap.add("Key", Value)
Add data to index
}  move to next iteration.

Is this kind of operation possible using JAVA REST API?

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