docs: def create_indexed_document(index_instance, model_items, action):
      '''
      Creates the document that will be passed into the bulk index function.
      Either a list of serialized objects to index, or a a dictionary specifying the primary keys of items to be delete.
      '''
      data = []
      if action == 'delete':
          for pk in model_items:
              data.append({'_id': pk, '_op_type': action})
      else:
          for doc in model_items:
              if index_instance.matches_indexing_condition(doc):
                  data.append(index_instance.serialize_object(doc))
      return data