anchor.diff:              {reply, cloudi_x_erlasticsearch:count({pool, PoolName}, Indexes, [], Doc, Params), State};
           {'count', Indexes, Types, Doc, Params} -> 
               {reply, cloudi_x_erlasticsearch:count({pool, PoolName}, Indexes, Types, Doc, Params), State};
  +        {'delete_by_query', Doc} ->
  +            {reply, cloudi_x_erlasticsearch:delete_by_query({pool, PoolName}, ?ALL, [], Doc, []), State};
           {'delete_by_query', Doc, Params} -> 
               {reply, cloudi_x_erlasticsearch:delete_by_query({pool, PoolName}, ?ALL, [], Doc, Params), State};
           {'delete_by_query', Indexes, Doc, Params} -> 
  
positive.code: do_query(Query, BinaryPoolName, _Timeout) ->
      try (case cloudi_string:binary_to_term(Query) of
  		        {'health'} -> 
  		            cloudi_x_erlasticsearch:health({pool, PoolName});
  		        {'state', Params} -> 
  		            cloudi_x_erlasticsearch:state({pool, PoolName}, Params);
  		        {'nodes_info'} ->
  		            cloudi_x_erlasticsearch:nodes_info({pool, PoolName}, [], []);
  		        {'nodes_info', NodeNames} ->
  		            cloudi_x_erlasticsearch:nodes_info({pool, PoolName}, NodeNames, []);
  		        {'nodes_info', NodeNames, Params} -> 
  		            cloudi_x_erlasticsearch:nodes_info({pool, PoolName}, NodeNames, Params);
  		        {'nodes_stats'} ->
  		            cloudi_x_erlasticsearch:nodes_stats({pool, PoolName}, [], []);
  		        {'nodes_stats', NodeNames} ->
  		            cloudi_x_erlasticsearch:nodes_stats({pool, PoolName}, NodeNames, []);
  		        {'nodes_stats', NodeNames, Params} -> 
  		            cloudi_x_erlasticsearch:nodes_stats({pool, PoolName}, NodeNames, Params);
  		        {'status', Indexes} -> 
  		            cloudi_x_erlasticsearch:status({pool, PoolName}, Indexes);
  		        {'create_index', Index} ->
  		            cloudi_x_erlasticsearch:create_index({pool, PoolName}, Index, <<>>);
  		        {'create_index', Index, Doc} -> 
  		            cloudi_x_erlasticsearch:create_index({pool, PoolName}, Index, Doc);
  		        {'delete_index'} ->
  		            cloudi_x_erlasticsearch:delete_index({pool, PoolName}, ?ALL);
  		        {'delete_index', Index} -> 
  		            cloudi_x_erlasticsearch:delete_index({pool, PoolName}, Index);
  		        {'open_index', Index} -> 
  		            cloudi_x_erlasticsearch:open_index({pool, PoolName}, Index);
  		        {'close_index', Index} -> 
  		            cloudi_x_erlasticsearch:close_index({pool, PoolName}, Index);
  		        {'is_index', Indexes} -> 
  		            cloudi_x_erlasticsearch:is_index({pool, PoolName}, Indexes);
  		        {'count', Doc} ->
  		            cloudi_x_erlasticsearch:count({pool, PoolName}, ?ALL, [], Doc, []);
  		        {'count', Doc, Params} ->
  		            cloudi_x_erlasticsearch:count({pool, PoolName}, ?ALL, [], Doc, Params);
  		        {'count', Indexes, Doc, Params} -> 
  		            cloudi_x_erlasticsearch:count({pool, PoolName}, Indexes, [], Doc, Params);
  		        {'count', Indexes, Types, Doc, Params} -> 
  		            cloudi_x_erlasticsearch:count({pool, PoolName}, Indexes, Types, Doc, Params);
  		        {'delete_by_query', Doc, Params} -> 
  		            cloudi_x_erlasticsearch:delete_by_query({pool, PoolName}, ?ALL, [], Doc, Params);
  		        {'delete_by_query', Indexes, Doc, Params} -> 
  		            cloudi_x_erlasticsearch:delete_by_query({pool, PoolName}, Indexes, [], Doc, Params);
  		        {'delete_by_query', Indexes, Types, Doc, Params} -> 
  		            cloudi_x_erlasticsearch:delete_by_query({pool, PoolName}, Indexes, Types, Doc, Params);
  		        {'is_type', Indexes, Types} -> 
  		            cloudi_x_erlasticsearch:is_type({pool, PoolName}, Indexes, Types);
  		        {'insert_doc', Index, Type, Id, Doc} ->
  		            cloudi_x_erlasticsearch:insert_doc({pool, PoolName}, Index, Type, Id, Doc, []);
  		        {'insert_doc', Index, Type, Id, Doc, Params} -> 
  		            cloudi_x_erlasticsearch:insert_doc({pool, PoolName}, Index, Type, Id, Doc, Params);
  		        {'is_doc', Index, Type, Id} -> 
  		            cloudi_x_erlasticsearch:is_doc({pool, PoolName}, Index, Type, Id);
  		        {'get_doc', Index, Type, Id} ->
  		            cloudi_x_erlasticsearch:get_doc({pool, PoolName}, Index, Type, Id, []);
  		        {'get_doc', Index, Type, Id, Params} -> 
  		            cloudi_x_erlasticsearch:get_doc({pool, PoolName}, Index, Type, Id, Params);
  		        {'mget_doc', Index, Doc} -> 
  		            cloudi_x_erlasticsearch:mget_doc({pool, PoolName}, Index, <<>>, Doc);
  		        {'mget_doc', Index, Type, Doc} -> 
  		            cloudi_x_erlasticsearch:mget_doc({pool, PoolName}, Index, Type, Doc);
  		        {'delete_doc', Index, Type, Id} ->
  		            cloudi_x_erlasticsearch:delete_doc({pool, PoolName}, Index, Type, Id, []);
  		        {'delete_doc', Index, Type, Id, Params} -> 
  		            cloudi_x_erlasticsearch:delete_doc({pool, PoolName}, Index, Type, Id, Params);
  		        {'search', Index, Type, Doc} ->
  		            cloudi_x_erlasticsearch:search({pool, PoolName}, Index, Type, Doc, []);
  		        {'search', Index, Type, Doc, Params} -> 
  		            cloudi_x_erlasticsearch:search({pool, PoolName}, Index, Type, Doc, Params);
  		        {'refresh'} ->
  		            cloudi_x_erlasticsearch:refresh({pool, PoolName}, ?ALL);
  		        {'refresh', Indexes} ->
  		            cloudi_x_erlasticsearch:refresh({pool, PoolName}, Indexes);
  		        {'flush'} ->
  		            cloudi_x_erlasticsearch:flush({pool, PoolName}, ?ALL);
  		        {'flush', Indexes} ->
  		            cloudi_x_erlasticsearch:flush({pool, PoolName}, Indexes);
  		        {'optimize'} ->
  		            cloudi_x_erlasticsearch:optimize({pool, PoolName}, ?ALL);
  		        {'optimize', Indexes} ->
  		            cloudi_x_erlasticsearch:optimize({pool, PoolName}, Indexes);
  		        {'segments'} ->
  		            cloudi_x_erlasticsearch:segments({pool, PoolName}, ?ALL);
  		        {'segments', Indexes} ->
  		            cloudi_x_erlasticsearch:segments({pool, PoolName}, Indexes);
  		        {'clear_cache'} ->
  		            cloudi_x_erlasticsearch:clear_cache({pool, PoolName}, ?ALL, []);
  		        {'clear_cache', Indexes} ->
  		            cloudi_x_erlasticsearch:clear_cache({pool, PoolName}, Indexes, []);
  		        {'clear_cache', Indexes, Params} ->
                      cloudi_x_erlasticsearch:clear_cache({pool, PoolName}, Indexes, Params);
                  _ ->
                      {error, invalid_call}
              end) of
  
negative.code:             {reply, do_query(Command, BinaryPoolName, Timeout), State};
          {'health'} -> 
              {reply, cloudi_x_erlasticsearch:health({pool, PoolName}), State};
          {'state'} ->
              {reply, cloudi_x_erlasticsearch:state({pool, PoolName}, []), State};
          {'state', Params} -> 
              {reply, cloudi_x_erlasticsearch:state({pool, PoolName}, Params), State};
          {'nodes_info'} ->
  