elasticsearch - 为什么此范围查询返回空结果?

标签 elasticsearch

我正在查询Elasticsearch(2.0)集群,想获取时间戳比特定时间戳早的事件(在以下情况下为2015年8月30日):

POST /constant_scan/vulnerability/_search
{
   "query":{
      "filtered":{
         "filter":{
            "range":{
               "HOST_START_iso":{
                  "lt":"2015-08-30"
               }
            }
         }
      }
   }
}

该搜索返回
{
   "took": 44,
   "timed_out": false,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   },
   "hits": {
      "total": 0,
      "max_score": null,
      "hits": []
   }
}

DB有相关记录。对所有元素的查询将返回带有时间戳记的条目(其中包括8月20日(早于8月30日))
{
   "took": 241,
   "timed_out": false,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   },
   "hits": {
      "total": 58517,
      "max_score": 1,
      "hits": [
         {
            "_index": "scan_constant",
            "_type": "vulnerability",
            "_id": "10.89.0.103",
            "_score": 1,
            "_source": {
               "private": true,
               "authenticated": false,
               "HOST_START_iso": "2015-08-20T10:19:24+00:00"
            }
         },
         (...)

我尝试使用完整的ISO日期作为分隔符,尝试使用lte而不是lt-相同的结果。搜索日期与日期相同的事件(该日期的两边都有事件)

最佳答案

您正在查询constant_scan索引

POST /constant_scan/vulnerability/_search

文档存储在scan_constant索引中时(根据您提供的示例文档)

尝试将查询发布到此URL:
POST /scan_constant/vulnerability/_search

关于elasticsearch - 为什么此范围查询返回空结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33147592/

相关文章:

elasticsearch - 根据7.X语法使用Elasticsearch Analysis API时,使用1.X版本显示错误的 token

java - 使用 Java 获取 Amazon Elasticsearch 数据

mysql - 如何设置logstash.conf?

lucene - “boost”对文档和查询意味着什么?

elasticsearch - ElasticSearch完成建议程序-不返回数据

design-patterns - 聚合 ID 设计模式

scala - Spark Elasticsearch 抛出403禁止错误

Elasticsearch 多前缀关键字

ruby-on-rails - 保持elasticsearch和数据库同步

elasticsearch - Elasticsearch:为什么Java客户端使用不同的查询语法?