anchor.diff:        end;
       _ ->
         Query = build_query(Conditions, Bucket),
  -      case search_docs_by(DocName, Conn, Index, Query, 0, 0) of
  +      case search_keys_by(Conn, Index, Query, [], 0, 0) of
           {ok, {Total, Res}}  ->
  -          delete_docs(Conn, Bucket, Res, Opts),
  +          delete_keys(Conn, Bucket, Res, Opts),
             {ok, Total, State};
           {error, Error} ->
             {error, Error, State}
  
positive.code:   end.
  
  %% @private
  search_docs_by(DocName, Conn, Index, Query, Limit, Offset) ->
    case search(Conn, Index, Query, [], Limit, Offset) of
      {ok, {search_results, Results, _, Total}} ->
        F = fun({_, KV}, Acc) -> [kv_to_doc(DocName, KV) | Acc] end,
        NewRes = lists:reverse(lists:foldl(F, [], Results)),
        {ok, {Total, NewRes}};
      {error, Error} ->
        {error, Error}
    end.
  
  %% @private
  delete_docs(Conn, Bucket, Docs, Opts) ->
    lists:foreach(fun(D) ->
      K = doc_id(D),
      delete_map(Conn, Bucket, K, Opts)
    end, Docs).
  
  %%%=============================================================================
  %%% Query Builder
  
negative.code:   #state{conn = Conn, bucket = Bucket, index = Index, del_opts = Opts} = State,
    TranslatedConditions = transform_conditions(DocName, Conditions),
    Query = build_query(TranslatedConditions, Bucket),
    case search_keys_by(Conn, Index, Query, [], 0, 0) of
      {ok, {Total, Res}}  ->
        delete_keys(Conn, Bucket, Res, Opts),
        {ok, Total, State};
      {error, Error} ->
        {error, Error, State}
  