graphrag icon indicating copy to clipboard operation
graphrag copied to clipboard

feat: Add ElasticSearch vector store support

Open gkswns0531 opened this issue 5 months ago • 1 comments

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: Complete BaseVectorStore interface implementation
  • Factory Integration: Added to VectorStoreFactory with elasticsearch type
  • 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 implementation
  • tests/integration/vector_stores/test_elasticsearch.py (+315 lines) - Tests
  • graphrag/vector_stores/factory.py (+4 lines) - Factory integration
  • pyproject.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).

gkswns0531 avatar Jul 21 '25 10:07 gkswns0531

@microsoft-github-policy-service agree

gkswns0531 avatar Jul 21 '25 10:07 gkswns0531