In the elastic search we have logs with fi_id as BA-844, BAX-844, BA-SYSTEM-844 and BA-090, BAX-090, BA-SYSTEM-WER-090 and many more with same numeric value as last part of the string.
I want to write the elastic query to return the consolidated complete count, in which 844 and 090 is present as last part of the string after "-".
The below query gave me different counts as shown below: Sample:
GET /ibs-ccbilling-2020.09/_search
{
"aggs": {
"by_fiId": {
"terms": {
"field": "fi_id.keyword",
"size": 100
}
}
}
}
Result:
{
"key": "D1BANK-334",
"doc_count": 19
},
{
"key": "BAX-777-System",
"doc_count": 10
},
{
"key": "BA-409",
"doc_count": 6
},
{
"key": "D1CONSUMER-334",
"doc_count": 4
},
I want the result would be 19+4 as 23 for key "334".