本文介绍了如何通知 Elasticsearch 客户端有新的索引文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Elasticsearch,我正在构建一个客户端(使用 Java 客户端 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

使用此插件,您可以注册到 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 日):

根据 Elastic{ON} Zurich 2019 上所说的,在 7.x 系列的某个时候,将会有一个 Changes API 将提供索引更改通知(文档创建、更新、删除等).

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 客户端有新的索引文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 03:00