Add test case and bug fix for double serialization of delete_by_query queries.