[英]elastic search bool query errors
I'm trying to run an elasticsearch query defined like so: 我正在尝试运行如下定义的elasticsearch查询:
query = {
"query": {
"bool": {
"should": [
{"term": {"a": "a1"}},
{"term": {"b": "b1"}},
{"term": {"c": "c1"}}
],
},
},
}
es.search("my_index", body=q1)
But I get the following error: 但是我收到以下错误:
RequestError: TransportError(400, 'search_phase_execution_exception',
'failed to create query:
...
What's the problem with the query? 查询有什么问题?
It may be failing to parse the JSON since you have a trailing comma in your array. 由于数组中有尾部逗号,因此可能无法解析JSON。 (and a couple more after each of your query and bool properties) The JSON spec does not allow for superfluous trailing commas. (以及每个查询和bool属性后面的几个)JSON规范不允许多余的尾部逗号。
Try with this :- 试试这个:-
{
"query": {
"bool": {
"should": [
{"term": {"a": "a1"}},
{"term": {"b": "b1"}},
{"term": {"c": "c1"}}
]
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.