Hello Team,
I am using this piece of code to update to the elasticsearch index, everything is working fine, but the document is having a list which is getting overridden, and not appended. I am using a bulkprocessor to insert all the data to the index. I am updating the content based on the sessionId.
IndexRequest request = new IndexRequest(elasticSummaryIndex, "kafka");
request.id((String) communicationSessionsMap.get("communicationSessionID"));
request.source(communicationSessionsMap, XContentType.JSON);
bulkProcessor.add(request);
I am using a bulkprocessor which is pushing data for every 10000 requests and when the max size reaches 5mb.
Can you please help me out as I need to append new data to the list and not update the content as a whole.
The actual output should be like this --
{
"_index": "kafka_gw_visibility_summary",
"_type": "kafka",
"_id": "HttpServerAdapter_15633763427671124:-999",
"_version": 7,
"_score": 0,
"_source": {
"protocol": "HTTP",
"communicationTrackingEvents": [
{
"eventName": "CommConnect",
"startTime": "2019-07-17 15:12:22.767",
"endTime": "2019-07-17 15:12:22.767"
},
{
"fileSize": "1001",
"eventName": "CommFileXferBegin",
"startTime": "2019-07-17 15:12:22.814",
"transferId": "HttpServerAdapter_15633763427671124:-999-1"
},
{
"eventName": "CommFileXferComplete",
"endTime": "2019-07-17 15:12:22.814",
"transferId": "HttpServerAdapter_15633763427671124:-999-1"
},
{
"eventName": "CommAuthorization"
},
{
"fileSize": "41",
"eventName": "CommFileXferBegin",
"startTime": "2019-07-17 15:12:23.164",
"transferId": "HttpServerAdapter_15633763427671124:-999-3"
},
{
"eventName": "CommFileXferComplete",
"endTime": "2019-07-17 15:12:23.164",
"transferId": "HttpServerAdapter_15633763427671124:-999-3"
},
{
"eventName": "CommDisconnect",
"startTime": "2019-07-17 15:12:23.164",
"endTime": "2019-07-17 15:12:23.164"
}
],
"communicationSessionID": "HttpServerAdapter_15633763427671124:-999",
"locallyInitialized": "false",
"startTime": "2019-07-17 15:12:23.164",
"endTime": "2019-07-17 15:12:23.164",
"state": "Initialized",
"status": "true"
}
}
but I am actually getting ,
{
"_index": "kafka_gw_visibility_summary_new",
"_type": "kafka",
"_id": "HttpServerAdapter_156337651275912491:-999",
"_version": 3,
"_score": 1,
"_source": {
"protocol": "HTTP",
"communicationTrackingEvents": [
{
"eventName": "CommDisconnect",
"startTime": "2019-07-17 15:12:23.164",
"endTime": "2019-07-17 15:12:23.164"
}
],
"communicationSessionID": "HttpServerAdapter_156337651275912491:-999",
"locallyInitialized": "false",
"startTime": "2019-07-17 15:15:14.457",
"endTime": "2019-07-17 15:15:14.457",
"state": "Initialized",
"status": "true"
}
}
Any suggestion will be highly appreciated