def _delete_not_existing_keywords(indexer, keywords_api, keywords_db):
    """Delete not existing keywords."""
    to_soft_delete = []
    keys_loaded = keywords_api.keys()
    for keyword in keywords_db:
        if keyword['deleted'] is False and keyword['key_id'
            ] not in keys_loaded:
            keyword['deleted'] = True
            keyword.commit()
            to_soft_delete.append(str(keyword.id))
    indexer.bulk_index(iter(to_soft_delete))
