A quick query to get the max and min timestamp values of an index:
#Find the date range of records within an index
curl -X GET "https://opensearch.example.com:9200/INDEX_NAME/_search" -H 'Content-Type: application/json' -d'
{
"size": 0,
"aggs": {
"oldest_timestamp": {
"min": {
"field": "@timestamp"
}
},
"newest_timestamp": {
"max": {
"field": "@timestamp"
}
}
}
}'