@mastra/elasticsearch 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-rag-vector-databases.md +28 -4
- package/dist/docs/references/reference-vectors-elasticsearch.md +2 -0
- package/dist/index.cjs +840 -1072
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +127 -125
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +127 -125
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +837 -1068
- package/dist/index.js.map +1 -1
- package/package.json +17 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @mastra/elasticsearch
|
|
2
2
|
|
|
3
|
+
## 1.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dependencies updates: ([#19779](https://github.com/mastra-ai/mastra/pull/19779))
|
|
8
|
+
- Updated dependency [`@elastic/elasticsearch@^8.19.2` ↗︎](https://www.npmjs.com/package/@elastic/elasticsearch/v/8.19.2) (from `^8.19.1`, in `dependencies`)
|
|
9
|
+
- Updated dependencies [[`3f472b4`](https://github.com/mastra-ai/mastra/commit/3f472b468892a1ff14ccb43cc0343b86f7d8fd7d), [`ba369f2`](https://github.com/mastra-ai/mastra/commit/ba369f2a0aaf998da0d6aa033d26f64f96bef8ac), [`35b929b`](https://github.com/mastra-ai/mastra/commit/35b929b7abc3d20d85c7985880960ac2d04a6c86), [`55c9e24`](https://github.com/mastra-ai/mastra/commit/55c9e248c27c1d72b5bb7e94ea6b8a3999eee49f), [`dcfed93`](https://github.com/mastra-ai/mastra/commit/dcfed93e1e256c6abfa792cbb7ca836f5d0e8638), [`2876e15`](https://github.com/mastra-ai/mastra/commit/2876e15b4d2f616a3bc1ed3af57d546c268384ce), [`9b3626a`](https://github.com/mastra-ai/mastra/commit/9b3626aeb1d16fcd34b0a8e94c114ddb80a3b240), [`4696963`](https://github.com/mastra-ai/mastra/commit/469696312ac4c618bc8475b0c5ed7949b8a3455e), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`07f5b4b`](https://github.com/mastra-ai/mastra/commit/07f5b4ba9d608d88865030732e580298296adf99), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`598080f`](https://github.com/mastra-ai/mastra/commit/598080f224edb3f0f5b801035b067fac50a56a03)]:
|
|
10
|
+
- @mastra/core@1.55.0
|
|
11
|
+
|
|
12
|
+
## 1.3.1-alpha.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- dependencies updates: ([#19779](https://github.com/mastra-ai/mastra/pull/19779))
|
|
17
|
+
- Updated dependency [`@elastic/elasticsearch@^8.19.2` ↗︎](https://www.npmjs.com/package/@elastic/elasticsearch/v/8.19.2) (from `^8.19.1`, in `dependencies`)
|
|
18
|
+
- Updated dependencies [[`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73), [`723aa54`](https://github.com/mastra-ai/mastra/commit/723aa5437106bdb708ae03c0ef6b77aa11291e73)]:
|
|
19
|
+
- @mastra/core@1.55.0-alpha.3
|
|
20
|
+
|
|
3
21
|
## 1.3.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-elasticsearch
|
|
|
3
3
|
description: Documentation for @mastra/elasticsearch. Use when working with @mastra/elasticsearch APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/elasticsearch"
|
|
6
|
-
version: "1.3.
|
|
6
|
+
version: "1.3.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
1
3
|
# Storing embeddings in a vector database
|
|
2
4
|
|
|
3
|
-
After generating embeddings, you need to store them in a database that supports vector similarity search. Mastra provides a consistent interface for storing and querying embeddings across
|
|
5
|
+
After generating embeddings, you need to store them in a database that supports vector similarity search. Mastra provides a consistent interface for storing and querying embeddings across vector databases.
|
|
4
6
|
|
|
5
7
|
## Supported databases
|
|
6
8
|
|
|
@@ -12,7 +14,7 @@ import { MongoDBVector } from '@mastra/mongodb'
|
|
|
12
14
|
const store = new MongoDBVector({
|
|
13
15
|
id: 'mongodb-vector',
|
|
14
16
|
uri: process.env.MONGODB_URI,
|
|
15
|
-
dbName: process.env.
|
|
17
|
+
dbName: process.env.MONGODB_DB_NAME,
|
|
16
18
|
})
|
|
17
19
|
await store.createIndex({
|
|
18
20
|
indexName: 'myCollection',
|
|
@@ -25,10 +27,31 @@ await store.upsert({
|
|
|
25
27
|
})
|
|
26
28
|
```
|
|
27
29
|
|
|
28
|
-
### Using MongoDB Atlas Vector
|
|
30
|
+
### Using MongoDB Atlas Vector Search
|
|
29
31
|
|
|
30
32
|
For detailed setup instructions and best practices, see the [official MongoDB Atlas Vector Search documentation](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-overview/?utm_campaign=devrel\&utm_source=third-party-content\&utm_medium=cta\&utm_content=mastra-docs).
|
|
31
33
|
|
|
34
|
+
### Using VoyageAI with MongoDB
|
|
35
|
+
|
|
36
|
+
MongoDB works seamlessly with VoyageAI's embedding models, which are optimized for retrieval tasks. For complete examples and specialized models, see the [VoyageAI embeddings documentation](https://mastra.ai/models/embeddings) and [MongoDB vector reference](https://mastra.ai/reference/vectors/mongodb).
|
|
37
|
+
|
|
38
|
+
### Hybrid Search (Vector + Full-Text)
|
|
39
|
+
|
|
40
|
+
MongoDB supports hybrid search that fuses vector similarity with BM25 full-text search using server-side `$rankFusion` (requires MongoDB >= 8.0; generally available from 8.1, and enabled on Atlas 8.0.x). This is useful when you want to combine semantic and keyword-based retrieval:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
await store.createSearchIndex({ indexName: 'myCollection', fields: ['text'] })
|
|
44
|
+
const results = await store.hybridQuery({
|
|
45
|
+
indexName: 'myCollection',
|
|
46
|
+
queryVector: embedding,
|
|
47
|
+
query: 'search terms',
|
|
48
|
+
paths: ['text'],
|
|
49
|
+
topK: 10,
|
|
50
|
+
})
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
See the [MongoDB vector reference](https://mastra.ai/reference/vectors/mongodb) for details on `createSearchIndex()`, `textQuery()`, and `hybridQuery()`.
|
|
54
|
+
|
|
32
55
|
**PgVector**:
|
|
33
56
|
|
|
34
57
|
```ts
|
|
@@ -357,6 +380,7 @@ The dimension size must match the output dimension of your chosen embedding mode
|
|
|
357
380
|
|
|
358
381
|
- `OpenAI text-embedding-3-small`: 1536 dimensions (or custom, e.g., 256)
|
|
359
382
|
- `Cohere embed-multilingual-v3`: 1024 dimensions
|
|
383
|
+
- `VoyageAI voyage-3.5`: 1024 dimensions (or custom: 256, 512, 1024, 2048)
|
|
360
384
|
- `Google gemini-embedding-001`: 768 dimensions (or custom)
|
|
361
385
|
|
|
362
386
|
> **Warning:** Index dimensions can't be changed after creation. To use a different model, delete and recreate the index with the new dimension size.
|
|
@@ -547,7 +571,7 @@ The upsert operation:
|
|
|
547
571
|
|
|
548
572
|
Vector stores support rich metadata (any JSON-serializable fields) for filtering and organization. Since metadata is stored with no fixed schema, use consistent field naming to avoid unexpected query results.
|
|
549
573
|
|
|
550
|
-
> **Warning:** Metadata is
|
|
574
|
+
> **Warning:** Metadata is important for vector storage. Without it, you'd only have numerical embeddings with no way to return the original text or filter results. Always store at least the source text as metadata.
|
|
551
575
|
|
|
552
576
|
```ts
|
|
553
577
|
// Store embeddings with rich metadata for better organization and filtering
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
1
3
|
# Elasticsearch vector store
|
|
2
4
|
|
|
3
5
|
The `ElasticSearchVector` class provides vector search using [Elasticsearch](https://www.elastic.co/elasticsearch/) with its `dense_vector` field type and k-NN search capabilities. It's part of the `@mastra/elasticsearch` package.
|