This is my current query which fetches documents which are older than 365 days from now.
"query": {
"bool": {
"must": [
{
"match": {
"doc_type": "AP - ACH CHECKS"
}
},
{
"range": {
"capture_date": {
"lte": "now-365d"
}
}
}
]
}
}
But I need to fetch the documents which are older than 365 days from the capture_date field. So tried like below and didn't work
{
"range": {
"capture_date": {
"lte": "capture_date-365d"
}
}
}
What should be the correct format?