I am trying to generate the summary from some data available in Elasticsearch using Logstash in which i have fields like loan_account_no., customer_id, batch, rank, channel and many more. I am creating the primary key (_id) by the combining (loan_account_no, customer_id and batch) and using fingerprint to hash it. so its generating unique records in the index. So here in the data, "channel" is categorical variable which has 3 categories(''voicebot,'smarttext','email').In the summary i am generating the new fields based on the channel variable. The fields are as follows:-
1) voicebot_rank, 2) smarttext_rank, 3) email_rank,
and i am trying to update these fields in such a way :
(i) Assume i already have a data present for the particular(_id) including the new fields in summary index for the channel 'voicebot' and voicebot_rank is 5. (ii) What if the next time the data comes for the the same (_id) with the rank 6 for the channel 'voicebot' and i am trying to update rank by comparing the record present in the elasticsearch by new record through logstash. (iii) Trying same for the other fields too.
NOTE:- Input and output both are elasticsearch.
So here i have to compare the ranks of same (_id) and if existing rank is smaller than the previous existing rank then have to update the rank. current have to up