0

I am trying to combine match query and range query but its not working properly.

GET file*/_search
{  
   "query":{  
      "bool":{  
         "should":[  
            {  
               "match":{  
                  "message":"timeout"
               }
            },
            {  
               "match":{  
                  "message":"java.lang.IllegalStateException"
               }
            },
            {  
               "range":{  
                  "@timestamp":{  
                     "gt":"now-1h",
                     "lte":"now",
                     "time_zone":"+01:00"
                  }
               }
            }
         ]
      }
   }
}

Date filter is not working properly here ,am i doing something wrong here?

Thanks

1 Answer 1

2

Replace }, with ], and add filter to query. For example:

{
  "query": { 
    "bool": { 
      "should": [
        { "match":{ "message":"timeout" }},
        { "match":{ "message":"java.lang.IllegalStateException"}}  
      ],
      "filter": [ 
        { "range": { "@timestamp": { "gt": "now-15m", "lte": "now", "time_zone":"+01:00" }}} 
      ]
    }
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.