How to add values of a specific fields from 2 different version in Index?

Hi ,
I am looking for a way by which we can add value of a field already indexed with value of same field from new updated document to be indexed.
for e.g.
version 1 document:
{
"_index" : "test_index",
"_type" : "_doc",
"_id" : "1",
"_version" : 1,
"_score" : 0.2876821,
"_source" : {
"TRANSACTIONTYPE" : 12,
"ISCORRELATED" : "1",
"MOBILENUMBER" : "9765451087"
}
}

version 2 document:
{
"_index" : "test_index",
"_type" : "_doc",
"_id" : "1",
"_version" : 2,
"_score" : 0.2876821,
"_source" : {
"TRANSACTIONTYPE" : 10,
"ISCORRELATED" : "1",
"MOBILENUMBER" : "9765451087"
}
}

So after indexing version 2 document, TRANSACTIONTYPE should have 10 + 12 = 22 value. Any suggestions/help would be great.

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