'Create a stub object to be manipulated'

def factory_object(self, index, doc_type, data=None, id=None):

    data = (data or {})
    obj = self.model()
    obj._meta.index = index
    obj._meta.type = doc_type
    obj._meta.connection = self
    if id:
        obj._meta.id = id
    if data:
        obj.update(data)
    return obj
