Hello.
I've encountered the following problem.
I've updated elasticsearch and pyes and got the following elasticsearch error when doing delete_by_query request:
As you can see, query is malformed because request body contains string as a query object instead of the object itself.
This can be fixed by simply replacing line
body = {"query":self._encode_query(query)}
to
body = '{"query":%s}'%self._encode_query(query)
in the delete_by_query method of ES object (es.py) (Sorry, I'm too lazy to provide a pull request and I'm not certain whether this solution breaks something or not)
And also in my opinion this method should determine somehow whether it's necessary to wrap provided query into {"query":query} object or not. Otherwise when you test your queries with curl or something you should start them with top-level "query" field and when you write python code - you shouldn't. It is not the obvious nor documented behaviour.
Hello. I've encountered the following problem. I've updated elasticsearch and pyes and got the following elasticsearch error when doing delete_by_query request:
As you can see, query is malformed because request body contains string as a query object instead of the object itself. This can be fixed by simply replacing line
to
in the delete_by_query method of ES object (es.py) (Sorry, I'm too lazy to provide a pull request and I'm not certain whether this solution breaks something or not)
And also in my opinion this method should determine somehow whether it's necessary to wrap provided query into {"query":query} object or not. Otherwise when you test your queries with curl or something you should start them with top-level "query" field and when you write python code - you shouldn't. It is not the obvious nor documented behaviour.