elasticsearch - Elasticsearch范围查询不适用于匹配查询

标签 elasticsearch

我正在尝试将匹配查询和范围查询结合起来,但是无法正常工作。

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"
                  }
               }
            }
         ]
      }
   }
}

日期过滤器在这里不能正常工作,我在这里做错了吗?

谢谢

最佳答案

},替换为],并添加过滤器进行查询。例如:

{
  "query": { 
    "bool": { 
      "should": [
        { "match":{ "message":"timeout" }},
        { "match":{ "message":"java.lang.IllegalStateException"}}  
      ],
      "filter": [ 
        { "range": { "@timestamp": { "gt": "now-15m", "lte": "now", "time_zone":"+01:00" }}} 
      ]
    }
  }
}

关于elasticsearch - Elasticsearch范围查询不适用于匹配查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48769753/

相关文章:

Elasticsearch 上下文建议地理上下文 - 无需过滤即可提升?

ssl - 在 Elasticsearch 中启用 TLS

elasticsearch - 关键字查询中带空格的Elasticsearch关键字

elasticsearch - Elasticsearch 索引状态

elasticsearch - 将 Heroku Log Drain 连接到 Logstash

java - Elasticsearch :found jar hell in test classpath

elasticsearch - 在Jaeger ElasticSearch中搜索

php - 通过查询Elasticsearch-PHP Client 2.0+更新

elasticsearch - Logstash 5.1.1 kafka 输入不获取关于主题的现有消息

python - elasticsearch/Kibana 列表字段为 "?",虽然它在索引中是 "text",为什么?