Elasticsearch – Date/Time(String) Add/Subtract Duration – Days,Months,Years,Hours,Minutes,Seconds

Elasticsearch – Date/Time(String) Add/Subtract Duration – Days,Months,Years,Hours,Minutes,Seconds

Sample Query :

POST /test/test/_search
{
    "query": {
        "filtered": {
            "filter": {
                "bool": {
                    "must": [{
                        "range": {
                            "dateOrTimeAttribute": {
                                "from": "16:31:15",
                                "to": "16:31:15||+10m"
                            }
                        }
                    }]
                }
            }
        }
    }
}

Examples:

  • “16:31:15||+10m”
  • “16:31:15||+1d”
  • “2016-02-02||-1M”

 

[ YOU MAY ALSO LIKE ]

Leave a Reply