get - Retrieve
The get() method is used to retrieve documents from a collection without performing vector similarity search.
It supports filtering by IDs, metadata, and document.
info
This API can only be used when connected with SeekdbClient. For more information about SeekdbClient, see SeekdbClient.
Prerequisites
-
You have installed seekdb-js. For more information, see Quick start.
-
You have installed the server mode of seekdb. For more information, see Deploy seekdb by yum install.
-
You have connected to the database. For more information, see SeekdbClient.
-
You have created a collection and inserted data. For more information, see createCollection and add.
Request parameters
get()
| Parameter | Type | Required | Description | Example Value |
|---|---|---|---|---|
ids | string | string[] | Yes | The ID or list of IDs to retrieve. | ['1', '2'] |
where | Where | No | Metadata filter conditions. | { category: 'science' } |
whereDocument | WhereDocument | No | Document filter conditions. | {"$contains": "machine"} |
limit | number | No | The maximum number of results to return. | {"category": {"$eq": "AI"}} |
offset | number | No | The number of results to skip for pagination. | {"$contains": "machine"} |
include | readonly ("documents" | "metadatas" | "embeddings")[] | No | The list of fields to include: ["documents", "metadatas", "embeddings"]. | ["documents", "metadatas", "embeddings"] |
info
If no parameters are provided, all data is returned.
Request example
import { SeekdbClient } from "seekdb";
const client = new SeekdbClient({
host: "127.0.0.1",
port: 2881,
user: "root",
password: "",
database: "test",
});
const collection = await client.getCollection({name: 'my_collection'});
const result = await collection.get({
ids: ['1', '2']
});
Response parameters
- If a single ID is provided: the response includes the
getobject for that ID. - If multiple IDs are provided: a list of
QueryResultobjects, one for each ID. - If filters are provided: a
QueryResultobject containing all matching results.