当我试图包含一个具有模糊的必须要求和几个应有的要求且其中一个是通配符的复合 bool(boolean) 查询时,我遇到了此错误消息。到目前为止,语法上的任何更改都没有帮助我解决此问题。
查询:
{
"query": {
"bool": {
"must": {
"fuzzy": {
"message": "<fuzzy string>",
"fuzziness": "auto"
}
},
"should": [
{ "query": { "message": "<string>" } },
{ "query": { "message": "<string>" } },
{ "wildcard":
{
"query": { "message": "<partial string*>"}
}
}
],
"minimum_should_match": "50%"
}
}
}
<>
中的文本替换为我搜索的字符串。
最佳答案
您需要在query
子句中用match
替换bool/should
:
> { "query": {
> "bool": {
> "must": {
> "fuzzy": {
> "message": "<fuzzy string>",
> "fuzziness": "auto"
> }
> },
> "should": [
> {"match": {"message": "<string>"}}, <-- here
> {"match": {"message": "<string>"}}, <-- and here
> {"wildcard": {"query": {"message": "<partial string*>"}}}
> ],
> "minimum_should_match": "50%"
> } } }
关于json - 预期[END_OBJECT],但得到了[FIELD_NAME],在kibana中可能有太多查询子句错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42647570/