Reputation: 2283
I'm trying to run an elasticsearch query defined like so:
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?
Upvotes: 0
Views: 279
Reputation: 5050
Try with this :-
{
"query": {
"bool": {
"should": [
{"term": {"a": "a1"}},
{"term": {"b": "b1"}},
{"term": {"c": "c1"}}
]
}
}
}
Upvotes: 1
Reputation: 231
It may be failing to parse the JSON since you have a trailing comma in your array. (and a couple more after each of your query and bool properties) The JSON spec does not allow for superfluous trailing commas.
Upvotes: 0