feat: Add ElasticSearch vector store support
I would like to sincerely thank the MS GraphRAG team for creating such an outstanding project. It’s truly impressive, and I’ve been very eager to use it myself. However, since the environment I work in is based entirely on ElasticSearch, I ran into compatibility limitations with the existing vector store options. To address this, I implemented ElasticSearch support myself and am submitting this PR in the hope that it can be merged into the main project.
Description
Adds ElasticSearch vector store support to GraphRAG following the existing LanceDB implementation pattern. Enables enterprise organizations with ElasticSearch infrastructure to use GraphRAG without additional vector databases.
What's Implemented
ElasticSearchVectorStore: CompleteBaseVectorStoreinterface implementation- Factory Integration: Added to
VectorStoreFactorywithelasticsearchtype - Enterprise Features: KNN search, bulk operations, dynamic vector dimensions
- Full Compatibility: Zero breaking changes, works alongside existing stores
Testing
- 11 integration tests - 100% pass rate
- Validated: Real GraphRAG indexing/search workflows
Usage
vector_store:
default_vector_store:
type: elasticsearch
url: "http://localhost:9200"
es_index_name: "graphrag_entities"
Files Changed
graphrag/vector_stores/elasticsearch.py(+217 lines) - Core implementationtests/integration/vector_stores/test_elasticsearch.py(+315 lines) - Testsgraphrag/vector_stores/factory.py(+4 lines) - Factory integrationpyproject.toml(+1 line) - Dependency
Impact
- No Breaking Changes: Existing code continues to work
- Enterprise Ready: Leverages existing ElasticSearch infrastructure
- Production Tested: Validated with real GraphRAG workflows
Related Issues
#2001
Checklist
- [x] I have tested these changes locally.
- [x] I have reviewed the code changes.
- [x] I have updated the documentation (if necessary).
- [x] I have added appropriate unit tests (if applicable).
@microsoft-github-policy-service agree