anchor.diff:                  Index = <<"myindex">>,
                   Bucket = <<"mybucket">>,
                   ?assertEqual(ok, ?MODULE:create_search_index(Pid, Index)),
  -                wait_until( fun() ->
  -                    case ?MODULE:get_search_index(Pid, Index) of
  -                        {ok, IndexData} ->
  -                            proplists:get_value(index, IndexData) == Index;
  -                        {error, <<"notfound">>} ->
  -                            false
  -                    end
  -                end, 20, 1000 ),
                   ok = ?MODULE:set_search_index(Pid, Bucket, Index),
                   PO = riakc_obj:new(Bucket, <<"fred">>, <<"{\"name_s\":\"בָּרָא\"}">>, "application/json"),
                   {ok, _Obj} = ?MODULE:put(Pid, PO, [return_head]),
  
positive.code:                                                 Index,
                                                  SchemaName,
                                                  [{n_val,2}])),
                  wait_until( fun() ->
                      case ?MODULE:get_search_index(Pid, Index) of
                          {ok, IndexData} ->
                              proplists:get_value(index, IndexData) == Index andalso
                              proplists:get_value(schema, IndexData) == SchemaName andalso
                              proplists:get_value(n_val, IndexData) == 2;
                          {error, <<"notfound">>} ->
                              false
                      end
                  end, 20, 1000 ),
                  ?assertEqual({ok, [[{index,Index},
                                      {schema,SchemaName},
                                      {n_val,2}]]},
                               ?MODULE:list_search_indexes(Pid)),
                  ?assertEqual(ok, ?MODULE:delete_search_index(Pid, Index))
           end)}},
       {"create a search schema / get",
        {timeout, 30, ?_test(begin
                  reset_riak(),
  
negative.code:     create_search_index(Pid, Index, <<>>, []).
  
  %% @doc Create a search index.
  
  -spec create_search_index(pid(), binary(), binary(),
                            timeout()|search_admin_opts()) ->
                                   ok | {error, term()}.
  create_search_index(Pid, Index, SchemaName, Timeout)
    when is_integer(Timeout); Timeout =:= infinity  ->
      create_search_index(Pid, Index, SchemaName, [{timeout, Timeout}]);
  create_search_index(Pid, Index, SchemaName, Opts) ->
      Timeout = proplists:get_value(timeout, Opts, default_timeout(search_timeout)),
      NVal = proplists:get_value(n_val, Opts),
      Req = set_search_req_nval(NVal, Index, SchemaName),
      Req1 = set_search_req_timeout(Timeout, Req),
  
      Timeout1 = if
                     is_integer(Timeout) ->
                         %% Add an extra 500ms to the create_search_index timeout
                         %% and use that for the socket timeout.
                         %% This should give the creation to throw back a proper
                         %% response.
                         Timeout + 500;
                     true ->
                         Timeout
                 end,
      call_infinity(Pid, {req, Req1, Timeout1}).
  
  %% @doc Delete a search index.
  -spec delete_search_index(pid(), binary()) ->
  