Help with query (range)

Hey guys,

I need some help with a query. I´ve created a query which looks for are specific range of my property Ping (values greater or equal 1000), but it also needs to be in the last 1 hour. How can I achieve this result?

Here is my query:

"body": {
 "query": {
  "range": {
   "Ping": {
    "gte": 1000
   }
  }
 }
}

Hi,

Move your query into a BoolQuery, in a must condition, and add another range query on the time field with value = now-1h;

Bool query
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

Time manipulation
https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math

bye,
Xavier

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