hasTags()
的 hasTags()
函数接受一个或多个字符串类型的参数,如果传入的所有参数都存在于事件的标签中,则返回 true
。如果事件标签中不存在某个参数,则该函数返回 false
。
例如,如果您使用表达式 hasTags("tag1")
并且事件包含 tag1
,则 OpenSearch Data Prepper 返回 true
。如果您使用表达式 hasTags("tag2")
但事件仅包含 tag1
,则 Data Prepper 返回 false
。
示例
{
"events": [
{
"tags": ["tag1"],
"data": {
// ...
}
},
{
"tags": ["tag1", "tag2"],
"data": {
// ...
}
}
],
"expressions": [
{
"expression": "hasTags(\"tag1\")",
"expected_results": [true, true]
},
{
"expression": "hasTags(\"tag2\")",
"expected_results": [false, true]
}
]
}