Search API returns zero hits

Hi,

I have been witnessing a weird behavior when trying to query elasticsearch.

Ex:

GET my_logs*/_search
{
  "query": {"bool":                                     {"must": [
    {"range": {"timestamp": {"gt": "now-1M"}}}
                                               ]
                                      }
  }
}

returns:

{
  "took" : 8,
  "timed_out" : false,
  "_shards" : {
    "total" : 13,
    "successful" : 13,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  }
}

Whereas, If I change 'range' to 'now-2w' , the query returns hits. I'm confused with this behaviour, if 2 weeks old data query returns hits, why does 1 month old returns zero hits.

I don't see any errors in elasticsearch logs. (Discover tab in Kibana shows proper results as expected)

Elasticsearch version: 7.0.0

Hi @elk11,

I get same problem against master and 7.0. Please open an issue for this on github. It would be good to make a mini-example demonstrating the issue as well as to reference this discussion.

At least with my data, it seems like the issue is only with gt and that gte works fine. Maybe that can be a usable workaround?

1 Like

Thanks, @HenningAndersen.

Your suggested workaround of using 'gte' does work for me. I'll open as issue in elasticsearch github.

Closing the loop, the issue opened was https://github.com/elastic/elasticsearch/issues/43277

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