'Save the object and returns id'

def save(self, bulk=False, id=None, parent=None, routing=None, force=False):

    meta = self._meta
    conn = meta['connection']
    id = (id or meta.get('id', None))
    parent = (parent or meta.get('parent', None))
    routing = (routing or meta.get('routing', None))
    qargs = None
    if routing:
        qargs = {'routing': routing}
    version = meta.get('version', None)
    if force:
        version = None
    res = conn.index(self, meta.index, meta.type, id, parent=parent, bulk=bulk, version=version, force_insert=force, querystring_args=qargs)
    if (not bulk):
        self._meta.id = res._id
        self._meta.version = res._version
        return res._id
    return id
