READ ONLY LATEST RECORDS FROM AN INDEX USING SPARK-SCALA API

i want to read only the latest records from an index so i am passing the below query in my spark-scala code
conf.set("es.query","""{
"query": {
"match_all": {}
},
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
],
"size": 1
}""")

but this query doesn't fetch me the latest records instead it's fetching the older records. below is the output
data

and when i run this query in Kibana Dev Tools it's fetching me the latest records. please help :slightly_smiling_face:

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