我有这样的文件:Elasticsearch对文档条件过滤器与不同领域
Type 1 (stats from component A) -
_sources {
"@version": "1",
"@timestamp": "2015-11-02T06:50:11.170Z",
"stat_type": 1,
"ConnectionCount": 1,
"ReceivedCount": 2,
"AcceptedCount": 0,
"host": "my-pc",
"component_type": "A",
}
Type 2 (Stats from component B) -
_sources {
"@version": "1",
"@timestamp": "2015-11-02T06:50:11.170Z",
"stat_type": 1,
"SuccessCount": 2,
"host": "my-pc",
"component_type": "B",
}
从这两种类型的文档,我想要做以下的事情 -
- 如果ReceivedCount从doctypeA大于0,然后从doctypeB获取 SuccessCount。
- 如果它们不匹配,则使用elastalert进行警报。
我有elasticsearch和elastalert的基础知识。
我试图理解elasticserach脚本来查询elasticsearch,但不能这样做,因为两个记录中的不同列。
请指导。
我不确定ES的文档模型是否适合您描述的任务。当组件B的数据可用时,您是否需要定期或实时运行此检查? BTW时间戳字段似乎被弃用,文档建议您使用正常的日期时间字段并明确设置其值。 https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html – NikoNyrh
@NikoNyrh我需要定期运行此检查,间隔5分钟。感谢您的弃用信息。 –