def delete_embeddings_by_article_id()

in app/services/elasticsearch.py [0:0]


def delete_embeddings_by_article_id(client: Elasticsearch, index: str, article_id: str):
    """Delete all documents for an article with the given ID from the given index."""
    query = {"query": {"term": {"metadata.article_id": article_id}}}
    client.delete_by_query(index=index, body=query)
    logger.info(f"🗑️  Deleted embeddings for article {article_id}")