in app/services/elasticsearch.py [0:0]
def create_vector_index(client: Elasticsearch):
"""Create a vector index."""
client.indices.create(
index=ES_VECTOR_INDEX_NAME,
ignore=400,
body={
"mappings": {
"properties": {
"embedding": {
"type": "dense_vector",
"dims": 1536,
},
"page_content": {"type": "text"},
"metadata": {"type": "object"},
"article_id": {"type": "keyword"},
"chunk_id": {"type": "text"},
"article_hash": {"type": "keyword"},
}
}
},
)