如何将新的索引文档通知给Elasticsearch客户端? [英] How can a Elasticsearch client be notified of a new indexed document?
问题描述
我正在使用Elasticsearch,并且正在构建一个客户端(使用Java Client API)以导出通过Logstash建立索引的日志.
I am using Elasticsearch, and I am building a client (using the Java Client API) to export logs indexed via Logstash.
我希望能够在新文档成为索引(=已添加新的日志行)时收到通知(通过在某个位置添加侦听器),而不是查询最近的X个文档.
I would like to be able to be notified (by adding a listener somewhere) when a new document is index (= a new log line have been added) instead of querying the last X documents.
有可能吗?
推荐答案
这是您要查找的内容: https://github.com/ForgeRock/es-change-feed-plugin
This is what you're looking for: https://github.com/ForgeRock/es-change-feed-plugin
使用此插件,您可以注册到Websocket频道以接收发生索引编制/删除事件.不过,它具有一些限制.
Using this plugin, you can register to a websocket channel to receive indexation/deletion events as they happen. It has some limitations, though.
在过去,可以安装river插件以将文档流式传输到ES.河功能已被删除,但是上面的插件类似于反向河",当文档被索引时,ES会通知外部客户.
Back in the days, it was possible to install river plugins to stream documents to ES. The river feature has been removed, but this plugin above is like a "reverse river", where outside clients are notified by ES as documents get indexed.
非常有用,并且似乎是ES 6.x的最新版本
Very useful and seemingly up-to-date with ES 6.x
更新(2019年4月14日):
根据2019年苏黎世Elastic {ON}大会上的说法,在7.x系列中的某个时候,将会有一个
According to what was said at Elastic{ON} Zurich 2019, at some point in the 7.x series, there will be a Changes API that will provide index changes notifications (document creation, update, deletion and more).
这篇关于如何将新的索引文档通知给Elasticsearch客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!