JmesPath查找不存在的地方 [英] JmesPath find where not exists
本文介绍了JmesPath查找不存在的地方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下JmesPath表达式查找已被团队标记的实例:
The following JmesPath expression finds instances that have been tagged with a team:
"Instances[?Tags[?Key=='team']]"
您知道如何查找没有被团队标记的实例吗?
Do you know how to find instances that are not tagged with a team?
我尝试过:
"Instances[?!Tags[?Key=='team']]"
-> !Tags[?Key=='team']]: event not found
"Instances[?null==Tags[?Key=='team']]"
-> [] <-- wrong answer
"Instances[?!not_null(Tags[?Key=='team'])]"
-> !not_null: event not found
非常感谢!
样本输入:
{ "Instances":
[ { "id": "i-911"
, "Tags":
[ {"Key":"owner", "Value":"Edu"}
, {"Key":"team", "Value":"forensics"}
]
, "many other keys": "stuff"
}
, { "id": "i-999"
, "Tags":
[ {"Key":"owner", "Value":"Edu"}
, {"Key":"note", "Value":"No team!"}
]
, "many other keys": "stuff"
}
]
}
推荐答案
已解决:括号就是答案:
Solved: Parentheses are the answer:
"Instances[?!(Tags[?Key=='team'])]"
这篇关于JmesPath查找不存在的地方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文