Want to fetch latest record from the list of records in kibana using DSL query

We are using the ELK v7.3.2 version.

We have requirement in Kibana that we have list of records which are displaying in the Kibana data table. We need to display last updated record on top of the table. For which we are using below DSL query but which is not working.Can you please help us to resolve this issue.

    {

  "query": {

    "match_all": { }

  },

"aggs": {

"actual_trans_type.keyword": {

    "terms": {

        "field": "@timestamp"

    },

    "aggs": {

            "top_hit": {

                "sort": [

                    {

                        "fieldName": {

                            "order": "desc"

                        }

                    }

                ],

                "size": 2

            }

        }

        }

     }

}

You need to set the sorting field for top hit to your timestamp in order to get the latest document.
Easy way to debug would be this: set it up in a metric visualization and use inspector to look at how the request is built.
This is how to do it in a metric visualization: Display latest value in a „Metric“