I am trying to create a aggregation query to filter data if 2 columns in same index is matching. My InputDate is '2022-03-02T03:33:34.000Z' format and exeDate in '2022-03-02'. if both dates are same then need to sum up the amount of those entries. I tried below query. I am facing issue in both date comparision
{
"query": {
"bool": {
"must": [
{
"script": {
"script": {
"source": "doc['exeDate'].value == doc['inputDate'].value",
"lang": "painless"
}
}
}
] ,
"should": []
}
},
"from": 0,
"size": 10,
"sort": [],
"aggs": {
"action": {
"terms": {
"field": "actionname.keyword"
},
"aggs": {
"total": {
"value_count": {
"field": "actionStatus.keyword"
}
},
"amount": {
"sum": {
"script": {
"lang": "painless",
"source": "(params['status'].contains(doc['actionStatus.keyword'].value))? doc['amount'].value:0",
"params": {
"status": [
"Completed"
]
}
}
}
}
}
}
}
}
How do i modify this query to match only date, not with time