hi can anyone share their experience in creating aging column?
the process is i need to calculate aging of days that a payment made between number of days invoice date - invoice due date
thank you for sharing
hi can anyone share their experience in creating aging column?
the process is i need to calculate aging of days that a payment made between number of days invoice date - invoice due date
thank you for sharing
You can calculate the aging using Kibana scripted fields
So Basically you can a new scripted field called "aging_das" to your invoices index pattern then use this fiel to build a histogram based 30 days for example ...
Here is a snippet on how to add a scripted field on a DSL query, same painless code can be used in Kibana scripted field
GET invoices-payments/_search
{
"_source": ["invoice_date", "due_date", "invoice_id"],
"script_fields": {
"aging_days": {
"script": {
"source": "(doc['due_date'].value.toInstant().toEpochMilli() - doc['invoice_date'].value.toInstant().toEpochMilli()) / params.factor",
"params": {
"factor": 86400000
}
}
}
}
}
Use only the content of the source like this
(doc['due_date'].value.toInstant().toEpochMilli() - doc['invoice_date'].value.toInstant().toEpochMilli()) / 86400000
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.