我正在尝试在Kibana中为特定的URI做一个DSL查询过滤器,同时匹配多个IP子网。到目前为止,我已经设法使其仅可用于一个IP子网:
{
"query": {
"bool": {
"must": [
{
"match": {
"uripath": "/specific-uri-path"
}
},
{
"match": {
"clientip": "10.0.0.0/8"
}
}
]
}
}
}
但是,如果我尝试匹配多个子网,它将失败(可能是因为匹配只能包含不同的字段):
{
"query": {
"bool": {
"must": [
{
"match": {
"uripath": "/specific-uri-path"
}
},
{
"match": {
"clientip": "10.0.0.0/8",
"match": {
"clientip": "14.0.0.0/8"
}
}
]
}
}
}
我能够使其与术语查询一起使用。这意味着我还可以为“ clientip”使用值的数组,因此总的来说更干净。我希望它也会对其他人有帮助。
{
"query": {
"bool": {
"must": [
{
"match": {
"uripath.keyword": "/specific-uri-path"
}
},
{
"terms": {
"clientip": [
"10.0.0.0/8",
"14.0.0.0/8",
"20.0.0.0/8"
]
}
}
]
}
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句