fix(vector-stores): add agent_id and run_id to Elasticsearch/OpenSearch default mappings (#4906)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jessai2099
2026-04-21 01:40:59 +08:00
committed by GitHub
parent 8ba225cec8
commit 573e5212a4
4 changed files with 24 additions and 2 deletions
@@ -96,6 +96,10 @@ class TestElasticsearchDB(unittest.TestCase):
self.assertEqual(mappings["vector"]["index"], True)
self.assertEqual(mappings["vector"]["similarity"], "cosine")
self.assertEqual(mappings["metadata"]["type"], "object")
metadata_props = mappings["metadata"]["properties"]
self.assertEqual(metadata_props["user_id"]["type"], "keyword")
self.assertEqual(metadata_props["agent_id"]["type"], "keyword")
self.assertEqual(metadata_props["run_id"]["type"], "keyword")
# Reset mocks for next test
self.client_mock.reset_mock()
+4
View File
@@ -142,6 +142,10 @@ class TestOpenSearchDB(unittest.TestCase):
mappings = create_args["body"]["mappings"]["properties"]
self.assertEqual(mappings["vector_field"]["type"], "knn_vector")
self.assertEqual(mappings["vector_field"]["dimension"], 1536)
metadata_props = mappings["metadata"]["properties"]
self.assertEqual(metadata_props["user_id"]["type"], "keyword")
self.assertEqual(metadata_props["agent_id"]["type"], "keyword")
self.assertEqual(metadata_props["run_id"]["type"], "keyword")
self.client_mock.reset_mock()
self.client_mock.indices.exists.return_value = True
self.os_db.create_index()