def update(self, id, extra_doc, upsert=True):          # pylint: disable=redefined-builtin
        '''update an existing doc with extra_doc.
           allow to set upsert=True, to insert new docs.
        '''
        body = {'doc': extra_doc}
        if upsert:
            body['doc_as_upsert'] = True
        return self._es.update(index=self._index, doc_type=self._doc_type, id=id, body=body)