Hi Comunity! I’m recently joined to this. My name is Catriel and I (and my team) support one OpenSearch cluster deployed in AWS as ‘managed cluster’, ver. 2.15.
Now, I’m face on to a new challenge related to OpenSearch visualizations. First, say “Dashboards and visualizations scope is new to me”.
Below, details of scenario and request to solve.
We have one index with documents, each document contain information about transactions processed by our system.
One document contain information about one transaction.
This documents contain one unique ID per transaction (field ‘trxId’) and one status for this (field ‘trxStatus’) [booth fields as ‘keyword’ type].
Then, our system start to ingest documents for each transactions with status (‘PENDING’), this is the initial status for all transactions.
Usually, we have multiple documents for the same transaction with initial status ‘PENDING’.
Some time later, our system ingest a new document with status changed (‘APPROVED’ or ‘DECLINED’) for each transaction.
Finally, we need build a new visualization to ‘count’ transactions in the diferent status (‘PENDING’, ‘APPROVED’ and ‘DECLINED’), the logic for this will be:
- For each ‘trxId’ count one transaction
- For each ‘trxId’ with status ‘PENDING’ and without status ‘APPROVED’ or DECLINED’ count one “pending transaction”
- For each ‘trxId’ with status ‘APPROVED’ count one “approved transaction”
- For each ‘trxId’ with status ‘DECLINED’ count one “declined transaction”
I share example of our documents ingested as reference (one document per line):
@timestamp: “2025-04-03 21:19:01.000”, trxId: “001-000”, trxStatus: “PENDING”
@timestamp: “2025-04-03 21:19:02.000”, trxId: “001-000”, trxStatus: “PENDING”
@timestamp: “2025-04-03 21:19:03.000”, trxId: “001-000”, trxStatus: “PENDING”
@timestamp: “2025-04-03 21:19:04.000”, trxId: “002-000”, trxStatus: “PENDING”
@timestamp: “2025-04-03 21:19:05.000”, trxId: “002-000”, trxStatus: “PENDING”
@timestamp: “2025-04-03 21:19:06.000”, trxId: “002-000”, trxStatus: “APPROVED”
@timestamp: “2025-04-03 21:19:07.000”, trxId: “003-000”, trxStatus: “PENDING”
@timestamp: “2025-04-03 21:19:08.000”, trxId: “003-000”, trxStatus: “PENDING”
@timestamp: “2025-04-03 21:19:09.000”, trxId: “003-000”, trxStatus: “DECLINED”
then, the visualization will show the next values:
pending transaction = 1 (explanation: because for trxId=001-000 we have only ‘PENDING’ status, not ‘APPROVED’ or ‘DECLINED’ status for this one)
approved transaction = 1 (explanation: because trxId=002-000 adquire status ‘DECLINED’ in document with timestamp “2025-04-03 21:19:06.000”)
declined transaction = 1 (explanation: because trxId=003-000 adquire status ‘DECLINED’ in document with timestamp “2025-04-03 21:19:09.000”)
I started to think in the solution using some kind of coditions to evaluate documents across the index (e.g. if for each ‘trxId=XXX-XXX’; have documents with ‘trxStatus=PENDING’ and not have documents with ‘trxStatus=APPROVED’ or ‘trxStatus=DECLINED’; then count as ‘pending transaction’) … but I’m not shure if this is the correct way.
Any idea or sugestion will be great! Thanks so much.