如何从搜索中排除字段中的 {}
How to exclude {} in a field from a search
我有这样的记录
```
"log":{
"Level":空,
"Message": "blah",
"StackTrace": "{}"
}
```
我试过
```
{
"query":{
"bool":{
"must_not":[{
"match":{
"log.StackTrace":{
"query": "{}",
"type": "phrase"
}
}
}]
}
}
}
```
但仍然无法从搜索结果中排除这条记录
在 must_not 子句中将其作为术语查询并使用 log.StackTrace.Keyword 作为字段
{ "query": { "bool": { "must_not": { "term" { "log.StackTrace.keyword": "{}" } } }}
我有这样的记录
```
"log":{ "Level":空, "Message": "blah", "StackTrace": "{}" }
```
我试过
``` { "query":{ "bool":{ "must_not":[{ "match":{ "log.StackTrace":{ "query": "{}", "type": "phrase" } } }] }
}
} ```
但仍然无法从搜索结果中排除这条记录
在 must_not 子句中将其作为术语查询并使用 log.StackTrace.Keyword 作为字段
{ "query": { "bool": { "must_not": { "term" { "log.StackTrace.keyword": "{}" } } }}