【问题标题】:Elastic Search Lucene Query by Time in Python在 Python 中按时间进行弹性搜索 Lucene 查询
【发布时间】:2014-10-11 23:56:22
【问题描述】:

我很难使用 Kibana 和 Python pyes 库查询 Elastic Search

https://pyes.readthedocs.org/en/latest/index.html

我需要获取某个field在时间范围内过滤的所有数据。

假设我想在2014-08-17 20:00:002014-08-17 21:00:00 之间的时间范围内通过字段_customer_id 获取所有数据。这是我的开始,但不知道下一步该做什么。

import pyes
from pyes.query import FilteredQuery, MatchAllQuery, BoolQuery, TermQuery
conn = pyes.ES(['87.878.787:9200'])

q = TermQuery("@timestamp", "[2014-08-17T20:00:00 TO 2014-08-17T21:00:00]")
results = conn.search(query = q)

【问题讨论】:

    标签: python lucene elasticsearch logstash kibana


    【解决方案1】:

    如果您可以在 Kibana 中对其进行过滤,则有一个功能可以向您显示在每个面板上使用的查询。然后,您可以从那里轻松解决如何构建 Python 查询。

    【讨论】:

    • 澄清一下 - 这是每个面板右上角的小“i”信息图标。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-04
    • 2019-07-05
    相关资源
    最近更新 更多