Filter http - delete by query doesn't work

Hi guys,
in my pipeline, filter section I use the http plugin in order to remove old data:

http {
							url 					=> "http://localhost:9200/test-main/_delete_by_query"
							verb 					=> "POST"
							body_format		=> "json"
							body 					=> '{"query":{"bool":{"filter":[{"term":{"code":"%{[code]}"}},{"term":{"id":"%{[id]}"}},{"range":{"req-timestamp":{"lt":%{[req-timestamp]}}}}]}}}'
						}

But I noticed that the query fails because the documents that match the query are still present.
I tried running the same query (substituting parameters by hand) in dev tool and it works fine. If instead I make a POST request with postman, I get code 200 OK, but the documents are not removed.

What am I doing wrong?

Thanks in advance
Ely