根据特定条件在 Elasticsearch 中建立索引之前过滤掉文档

Filter out documents before indexing in Elasticsearch based on certain condition

我想知道是否可以在根据特定条件在 Elasticsearch 中建立索引之前过滤我们的文档。例如,如果 field1="something",我想将一个文档从索引中删除。我可以通过在 Elasticsearch 中使用开箱即用的处理器来解决这个问题并使用 "ingest node" 来覆盖它吗?如果不存在,我可以编写自定义处理器吗?

您不能在 Elasticsearch 中使用管道直接执行此操作(请参阅 this issue)。

但是,Logstash 有一个专门为此设计的 drop 过滤器,它可能对您的情况有用。