Lucene ElastAlert扁平线未找到结果

Lucene ElastAlert扁平线未找到结果,lucene,kibana,elastalert,Lucene,Kibana,Elastalert,使用ElastAlert框架创建一个flatline警报类型 当我在Kibana UI中使用完全相同的语法时,它会返回结果,但ElastAlert不会返回任何结果 这是我的elastalert-rule-file.xml name: Test Flatline type: flatline run_every: seconds: 15 relalert: minutes: 0 es_host: localhost es_port: 9200 threshold: 1 timef

使用ElastAlert框架创建一个
flatline
警报类型

当我在Kibana UI中使用完全相同的语法时,它会返回结果,但ElastAlert不会返回任何结果

这是我的elastalert-rule-file.xml

name: Test Flatline
type: flatline
run_every:
    seconds: 15
relalert: 
    minutes: 0
es_host: localhost
es_port: 9200
threshold: 1
timeframe: 
    minutes: 5
index: my-index-*
filter: 
- query:
    query_string:
        query: "_type:metric"  # this returns results in both kibana and elastalert
        #query: "_type:metric AND _exists_:My\ Field\ With\ Spaces.value" # this returns results in kibana but not in elastalert

timestamp_type: unix_ms
alert:
  - command
command: ["my-bash-script.sh"]
因此,我尝试使用查询,如果我只指定
\u type:metric
,那么Kibana中的搜索结果似乎与ElastAlert中的搜索结果匹配

但是,当我尝试在第二个查询中使用
\u exists\u
lucene语法时,ElastAlert不会返回任何内容,而Kibana似乎对语法没有问题


有什么想法吗?

我知道了……只是忘了贴答案

显然,对于带有空格的字段,您需要避开反斜杠,因此有问题的行如下所示:

query: "_type:metric AND _exists_:My\\ Field\\ With\\ Spaces.value"
query: "My\\\\ field\\\\ With\\\\ Spaces.value"
此外,在使用Ansible(YAML)配置的特殊情况下,需要添加反斜杠以转义每个反斜杠

因此YAML文件中的条目如下所示:

query: "_type:metric AND _exists_:My\\ Field\\ With\\ Spaces.value"
query: "My\\\\ field\\\\ With\\\\ Spaces.value"

我明白了…只是忘了贴答案

显然,对于带有空格的字段,您需要避开反斜杠,因此有问题的行如下所示:

query: "_type:metric AND _exists_:My\\ Field\\ With\\ Spaces.value"
query: "My\\\\ field\\\\ With\\\\ Spaces.value"
此外,在使用Ansible(YAML)配置的特殊情况下,需要添加反斜杠以转义每个反斜杠

因此YAML文件中的条目如下所示:

query: "_type:metric AND _exists_:My\\ Field\\ With\\ Spaces.value"
query: "My\\\\ field\\\\ With\\\\ Spaces.value"

可以通过对字段数据使用双引号来避免转义:

query: '_type:metric AND _exists_:"My Field With Spaces.value"'

可以通过对字段数据使用双引号来避免转义:

query: '_type:metric AND _exists_:"My Field With Spaces.value"'