Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Elasticsearch as a Vector Database Option, Issue 2309 #2520

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ AnythingLLM divides your documents into objects called `workspaces`. A Workspace
- [Qdrant](https://qdrant.tech)
- [Milvus](https://milvus.io)
- [Zilliz](https://zilliz.com)
- [Elasticsearch](https://www.elastic.co)

### Technical Overview

Expand Down
5 changes: 3 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@anthropic-ai/sdk": "^0.32.1",
"@azure/openai": "1.0.0-beta.10",
"@datastax/astra-db-ts": "^0.1.3",
"@elastic/elasticsearch": "^7.6.0",
"@google/generative-ai": "^0.7.1",
"@ladjs/graceful": "^3.2.2",
"@lancedb/lancedb": "0.5.2",
Expand Down Expand Up @@ -92,8 +93,8 @@
"flow-remove-types": "^2.217.1",
"globals": "^13.21.0",
"hermes-eslint": "^0.15.0",
"nodemon": "^2.0.22",
"node-html-markdown": "^1.3.0",
"nodemon": "^2.0.22",
"prettier": "^3.0.3"
}
}
}
4 changes: 4 additions & 0 deletions server/utils/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
*/
function getVectorDbClass() {
const vectorSelection = process.env.VECTOR_DB || "lancedb";

switch (vectorSelection) {
case "pinecone":
const { Pinecone } = require("../vectorDbProviders/pinecone");
Expand All @@ -81,6 +82,9 @@ function getVectorDbClass() {
case "astra":
const { AstraDB } = require("../vectorDbProviders/astra");
return AstraDB;
case "elasticsearch":
const { ElasticsearchDB } = require("../vectorDbProviders/elasticsearch");
return ElasticsearchDB;
default:
throw new Error("ENV: No VECTOR_DB value found in environment!");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# How to setup a local (or cloud) Elasticsearch Database

[Get an Elastisearch instance](https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html).

### How to get started _Development mode only_

After setting up either the Elasticsearch instance you just need to set these variable in `.env.development` or defined them at runtime via the UI.

```
VECTOR_DB="elasticsearch"
ELASTIC_ENDPOINT='http://127.0.0.1:9200'
# ELASTIC_API_HEADER="X-Api-Key" // If you have an Auth middleware on your instance.
# ELASTIC_API_KEY="sk-123abc" // If you have an Auth middleware on your instance.
```
Loading