How to convert Date to specific format and string to amount conversion

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

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.