我正试图在我的Kibana弹性搜索查询中有多个通配符查询匹配 . 我无法弄明白 .
基本上我想要任何属性类型=“erreur”的文档
我想在字段descr_courte上排除所有与字符串“An established *”或“java.lang . *”匹配的文档
{
"query": {
"bool": {
"must": {
"term": {
"type": "erreur"
}
},
"must_not": {
"wildcard": {
"descr_courte": ["An established*", "java.lang.*"]
}
}
}
}
}
如果我放一个通配符查询它工作正常
{
"query": {
"bool": {
"must": {
"term": {
"type": "erreur"
}
},
"must_not": {
"wildcard": {
"descr_courte":
"An established*"
}
}
}
}
}
我得到的错误:
错误:对Elasticsearch的请求失败:{“error”:{“root_cause”:[{“type”:“illegal_state_exception”,“reason”:“无法在1:454的START_ARRAY上获取文字”},“类型“:”search_phase_execution_exception“,”reason“:”所有分片有什么想法吗?
2 回答
尝试将它们作为单独的条款 .
我的猜测是你不能像
["An established*", "java.lang.*"]
那样为通配符查询创建一个数组,所以你需要:有关regexp查询的更多信息,请参阅https://www.elastic.co/guide/en/elasticsearch/reference/5.1/query-dsl-regexp-query.html
另一个选项是将查询字词与查询字符串中的逻辑运算符
NOT
,AND
和OR
组合在一起查看更多信息,请致电https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_wildcards