@mastra/opensearch 1.1.1-alpha.0 → 1.1.1-alpha.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/README.md +14 -38
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @mastra/opensearch
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The OpenSearchVector class provides vector search using OpenSearch, an open-source search and analytics engine.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
npm install @mastra/opensearch
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -16,58 +16,34 @@ import { OpenSearchVector } from '@mastra/opensearch';
|
|
|
16
16
|
const vectorStore = new OpenSearchVector('http://localhost:9200');
|
|
17
17
|
|
|
18
18
|
// Create an index
|
|
19
|
-
await vectorStore.createIndex({ indexName: 'my-collection', dimension:
|
|
19
|
+
await vectorStore.createIndex({ indexName: 'my-collection', dimension: 3, metric: 'cosine' });
|
|
20
20
|
|
|
21
21
|
// Add vectors with documents
|
|
22
|
-
const vectors = [
|
|
22
|
+
const vectors = [
|
|
23
|
+
[0.1, 0.2, 0.3],
|
|
24
|
+
[0.3, 0.4, 0.5],
|
|
25
|
+
];
|
|
23
26
|
const metadata = [{ text: 'doc1' }, { text: 'doc2' }];
|
|
24
27
|
const ids = await vectorStore.upsert({ indexName: 'my-collection', vectors, metadata });
|
|
25
28
|
|
|
26
29
|
// Query vectors with document filtering
|
|
27
30
|
const results = await vectorStore.query({
|
|
28
31
|
indexName: 'my-collection',
|
|
29
|
-
queryVector: [0.1, 0.2,
|
|
32
|
+
queryVector: [0.1, 0.2, 0.3],
|
|
30
33
|
topK: 10, // topK
|
|
31
34
|
filter: { text: { $eq: 'doc1' } }, // metadata filter
|
|
32
35
|
includeVector: false, // includeVector
|
|
33
36
|
});
|
|
34
37
|
```
|
|
35
38
|
|
|
36
|
-
##
|
|
39
|
+
## Documentation
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
- [Reference: OpenSearch vector store](https://mastra.ai/reference/vectors/opensearch)
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
## Changelog
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/stores/opensearch/CHANGELOG.md) for version history and release notes.
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
- Metadata filtering
|
|
46
|
-
- Optional vector inclusion in query results
|
|
47
|
-
- Automatic UUID generation for vectors
|
|
48
|
-
- Built on top of @opensearch-project/opensearch SDK
|
|
47
|
+
## Support
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
The following distance metrics are supported:
|
|
53
|
-
|
|
54
|
-
- `cosine` → Cosine distance
|
|
55
|
-
- `euclidean` → Euclidean distance
|
|
56
|
-
- `dotproduct` → Dot product
|
|
57
|
-
|
|
58
|
-
## Methods
|
|
59
|
-
|
|
60
|
-
- `createIndex({ indexName, dimension, metric? })`: Create a new collection
|
|
61
|
-
- `upsert({ indexName, vectors, metadata?, ids? })`: Add or update vectors
|
|
62
|
-
- `query({ indexName, queryVector, topK?, filter?, includeVector? })`: Search for similar vectors
|
|
63
|
-
- `updateVector({ indexName, id?, filter?, update })`: Update a single vector by ID or metadata filter
|
|
64
|
-
- `deleteVector({ indexName, id })`: Delete a single vector by ID
|
|
65
|
-
- `deleteVectors({ indexName, ids?, filter? })`: Delete multiple vectors by IDs or metadata filter
|
|
66
|
-
- `listIndexes()`: List all collections
|
|
67
|
-
- `describeIndex(indexName)`: Get collection statistics
|
|
68
|
-
- `deleteIndex(indexName)`: Delete a collection
|
|
69
|
-
|
|
70
|
-
## Related Links
|
|
71
|
-
|
|
72
|
-
- [OpenSearch Documentation](https://opensearch.org/docs/latest/about/)
|
|
73
|
-
- [OpenSearch REST API Reference](https://opensearch.org/docs/latest/api-reference/)
|
|
49
|
+
We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-opensearch
|
|
|
3
3
|
description: Documentation for @mastra/opensearch. Use when working with @mastra/opensearch APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/opensearch"
|
|
6
|
-
version: "1.1.1-alpha.
|
|
6
|
+
version: "1.1.1-alpha.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/opensearch",
|
|
3
|
-
"version": "1.1.1-alpha.
|
|
3
|
+
"version": "1.1.1-alpha.1",
|
|
4
4
|
"description": "OpenSearch vector store provider for Mastra",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"typescript": "^7.0.2",
|
|
32
32
|
"vitest": "4.1.10",
|
|
33
33
|
"@internal/lint": "0.0.129",
|
|
34
|
+
"@internal/storage-test-utils": "0.0.125",
|
|
34
35
|
"@internal/types-builder": "0.0.104",
|
|
35
|
-
"@mastra/core": "1.64.0-alpha.
|
|
36
|
-
"@internal/storage-test-utils": "0.0.125"
|
|
36
|
+
"@mastra/core": "1.64.0-alpha.7"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@mastra/core": ">=1.0.0-0 <2.0.0-0"
|