The following JmesPath expression finds instances that have been tagged with a team:
"Instances[?Tags[?Key=='team']]"
Run Code Online (Sandbox Code Playgroud)
Do you know how to find instances that are not tagged with a team?
I have tried:
"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
Run Code Online (Sandbox Code Playgroud)
Many thanks in advance!
Sample input:
{ "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"
}
]
}
Run Code Online (Sandbox Code Playgroud)
Max*_*phy 11
已解决:括号是答案:
"Instances[?!(Tags[?Key=='team'])]"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4085 次 |
| 最近记录: |