Return the most recent record from ElasticSearch index

后端 未结 8 1605
执笔经年
执笔经年 2020-12-13 23:01

I would like to return the most recent record (top 1) from ElasticSearch index similar to the sql query below;

SELECT         


        
8条回答
  •  别那么骄傲
    2020-12-13 23:57

    I used @timestamp instead of _timestamp

    {
        'size' : 1,
        'query': {
            'match_all' : {}
                },
        "sort" : [{"@timestamp":{"order": "desc"}}]
    }
    

提交回复
热议问题