我发送了这个查询,它运行良好,返回了经过筛选的数据:
{
"query": {
"bool": {
"filter": [
{
"match": {
"lang": "en"
}
}
]
}
},
"size": 10,
"from": 0,
"sort": []
}
如果我想用searchstring进行搜索,那么它也能很好地工作:
{
"query": {
"query_string": {
"query": "big size"
}
},
"size": 10,
"from": 0,
"sort": []
}
但我无法通过filter和searchstring一起从elastic中获取数据:
{
"query": {
"query_string": {
"query": "big size"
},
"bool": {
"filter": [
{
"match": {
"lang": "en"
}
}
]
}
},
"size": 10,
"from": 0,
"sort": []
}
我收到下一个错误:
Error 400.
{"error":{"root_cause":[{"type":"parsing_exception","reason":"[query_string] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":76}],"type":"parsing_exception","reason":"[query_string] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":76},"status":400}
1条答案
按热度按时间dzjeubhm1#
您的查询需要按如下所示重新构造。
质询: