【问题标题】:GET request to get the most recent event always returning the same thing in Elasticsearch获取最新事件的 GET 请求始终在 Elasticsearch 中返回相同的内容
【发布时间】:2017-01-27 20:43:23
【问题描述】:

我试图简单地让最近的事件发生在 curl 上,而且我总是得到同样的东西。这是我正在使用的卷曲:

curl localhost:9200/packetbeat-2017.01.26/_search?pretty=true -d '
{
"query": {
    "match_all": {}
},
"size": 1,
"sort": [{
    "_timestamp": {
        "order": "desc"
    }
}]
}

我尝试了升序和降序,它总是返回相同的事件。我的意思是我得到的信息总是相同的,即使是 ID(即使所有其他信息都相同,它也应该不同)。

【问题讨论】:

    标签: http curl elasticsearch get packetbeat


    【解决方案1】:

    Filebeat 将@timestamp 字段添加到它发送的事件中。所以尝试使用:

    curl -XGET "http://localhost:9200/filebeat-*/_search?pretty" -d'
    {
      "size": 1,
      "sort": [
        {
          "@timestamp": {
            "order": "desc"
          }
        }
      ]
    }'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-05-26
      • 1970-01-01
      • 1970-01-01
      • 2018-05-03
      • 1970-01-01
      • 1970-01-01
      • 2019-07-11
      相关资源
      最近更新 更多