anchor.diff:                      Ids :: [object_id()] |                   %% Initial entry
                              {[object_id()], [object_id()]},   %% Recursive calls; current batch & remaining IDs
                       BatchSize :: non_neg_integer(),
  -                    OrgId :: object_id(),
  +                    OrgInfo :: org_info(),
                       Index :: index(),
                       NameIdDict :: dict()) -> ok.
   batch_reindex(_, [], _, _, _, _) ->
       %% Nothing to process!
       ok;
  -batch_reindex(Ctx, Ids, BatchSize, OrgId, Index, NameIdDict) when is_list(Ids) ->
  -    batch_reindex(Ctx, safe_split(BatchSize, Ids), BatchSize, OrgId, Index, NameIdDict);
  -batch_reindex(Ctx, {LastBatch, []}, _BatchSize, OrgId, Index, NameIdDict) ->
  -    ok = index_a_batch(Ctx, LastBatch, OrgId, Index, NameIdDict),
  +batch_reindex(Ctx, Ids, BatchSize, OrgInfo, Index, NameIdDict) when is_list(Ids) ->
  +    batch_reindex(Ctx, safe_split(BatchSize, Ids), BatchSize, OrgInfo, Index, NameIdDict);
  +batch_reindex(Ctx, {LastBatch, []}, _BatchSize, OrgInfo, Index, NameIdDict) ->
  +    ok = index_a_batch(Ctx, LastBatch, OrgInfo, Index, NameIdDict),
       ok;
  -batch_reindex(Ctx, {CurrentBatch, Rest}, BatchSize, OrgId, Index, NameIdDict) ->
  -    ok = index_a_batch(Ctx, CurrentBatch, OrgId, Index, NameIdDict),
  -    batch_reindex(Ctx, safe_split(BatchSize, Rest), BatchSize, OrgId, Index, NameIdDict).
  +batch_reindex(Ctx, {CurrentBatch, Rest}, BatchSize, OrgInfo, Index, NameIdDict) ->
  +    ok = index_a_batch(Ctx, CurrentBatch, OrgInfo, Index, NameIdDict),
  +    batch_reindex(Ctx, safe_split(BatchSize, Rest), BatchSize, OrgInfo, Index, NameIdDict).
   
   %% @doc Helper function to retrieve and index objects for a single
   %% batch of database IDs.
   -spec index_a_batch(chef_db:db_context(),
                       BatchOfIds :: [object_id()],
  -                    OrgId :: object_id(),
  +                    OrgInfo :: org_info(),
                       Index :: index(),
                       NameIdDict :: dict()) -> ok.
  -index_a_batch(Ctx, BatchOfIds, OrgId, Index, NameIdDict) ->
  -    SerializedObjects = chef_db:bulk_get(Ctx, ?ORG_NAME, chef_object_type(Index), BatchOfIds),
  +index_a_batch(Ctx, BatchOfIds, {OrgId, OrgName}, Index, NameIdDict) ->
  +    SerializedObjects = chef_db:bulk_get(Ctx, OrgName, chef_object_type(Index), BatchOfIds),
       ok = send_to_index_queue(OrgId, Index, SerializedObjects, NameIdDict),
       ok.
   
  
positive.code: %% data reconstruction and begins the batch reindexing of all items of
  %% the given indexable type.
  -spec reindex(DbContext :: chef_db:db_context(),
                OrgId :: object_id(),
                Index :: index()) -> ok.
  reindex(Ctx, OrgId, Index) ->
      NameIdDict = chef_db:create_name_id_dict(Ctx, Index, OrgId),
      %% Grab all the database IDs to do batch retrieval on
      AllIds = dict:fold(fun(_K, V, Acc) -> [V|Acc] end,
                         [],
                         NameIdDict), %% All dict values will be unique anyway
      {ok, BatchSize} = application:get_env(chef_wm, bulk_fetch_batch_size),
      batch_reindex(Ctx, AllIds, BatchSize, OrgId, Index, NameIdDict).
  
  %% @doc Recursively batch-process a list of database IDs by retrieving
  %% the serialized_object data from the database, processing them as
  
negative.code: %% reindexing.  Does not drop existing index entries beforehand; this
  %% is explicitly a separate step.
  -spec reindex(Ctx :: chef_db:db_context(),
                OrgInfo :: org_info()) -> ok.
  reindex(Ctx, {OrgId, _OrgName}=OrgInfo) ->
      BuiltInIndexes = [node, role, environment, client],
      DataBags = chef_db:data_bag_names(Ctx, OrgId),
      AllIndexes = BuiltInIndexes ++ DataBags,
      [ reindex(Ctx, OrgInfo, Index) || Index <- AllIndexes ],
      ok.
  
  %% A note about our approach to reindexing:
  