Query with today date

Hello, I want to search on a date area to extract the data of the day from 7 hours, I hard coded, but I would like the day depends on the date I do the extraction , Thank you for your help.
GET /_search
{
"query": {
"bool": {
"must": [
{
"range": {
"datetime": {
"gte": "2019-01-24T07"
}
}
},
{
"term": {
"target": {
"value": "homer"
}
}
},
{
"term": {
"slo_violations": {
"value": "1"
}
}
}
]
}
}
}

Read https://www.elastic.co/guide/en/elasticsearch/reference/6.6/query-dsl-range-query.html#ranges-on-dates

1 Like

Thanks but I am french and google translation is not very good, I can not understand how to do, can you change my code please.
Michel.

I'm french too. You can also ask in #in-your-native-tongue:discussions-en-francais en français if you wish.

Closing the loop here. The answer was:

"gte": "now/d+7h"
2 Likes

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