首页 > 解决方案 > 如何在logstash中检查文档是否存在

问题描述

我有一个索引,其中包含使用 join 的父级和子级,但我不想为不存在的父级添加子级。所以我想要一个 if 来检查某个文档是否存在一个 id。就像是:

if(doc_id EXISTS %{parentid}){
}

我将如何为此编写 if ?当它存在时,它是一个如果。

标签: logstash

解决方案


@Tristan 你能修好它吗?我需要做类似的事情。有了这个我可以检查它是否存在,但我不知道如何让结果继续:

filter{
http {
    url => "http://localhost:9200/%{[@metadata][miEntidad]}/_search"
    http_method => "post"
    format => "message"
    content_type => "application/json; charset=UTF-8"
    message => '{"query": { "term": { "_id": "%{[id]}"  } }}'
}
}

推荐阅读