[英]ES: Match bool and fuzzy query
I have ES query. 我有ES查询。 Now I want add to this query 'fuzzy' parameter.
现在,我想向此查询添加“模糊”参数。 I'am trying :
我在尝试 :
"body" : {
"query" : {
"bool" : {
"must" : {
$finalQuery,
},
}
},
"match" : {
"city" : {
"query" : 'Tokkiio',
"fuzziness" : "AUTO"
},
}
}
$finalQuery is query generated in loop, contains terms, range and term parameters.
$ finalQuery是循环生成的查询,包含术语,范围和术语参数。
I am receiving : 我收到:
"{"error":{"root_cause":[{"type":"parsing_exception","reason":"[bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":177}],"type":"parsing_exception","reason":"[bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":177},"status":400}"
Thanks for help. 感谢帮助。
Please restructure the query into Query Context and Filter Context as documented here - https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html . -因为这里记录请重组查询到查询上下文和语境筛选https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html 。
Place your fuzzy query and similar conditions in query context. 将模糊查询和类似条件放在查询上下文中。 Move the range and any filter conditions to filter context.
移动范围和任何过滤条件以过滤上下文。 Here is a sample query.
这是一个示例查询。
{
"query":
{
"bool":
{
"must":
{
"fuzzy":
{
"city":
{
"value": "Tokkiio",
"fuzziness": "AUTO"
}
}
},
"filter":
{
"range":
{
"year":
{
"gte": 2016
}
}
}
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.