Can't assign my own ID to a vector in Milvus using Node.js sdk #30590
Replies: 1 comment
-
|
Hey, can you tell me how you resolved this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
HI there, I am struggling to add my own SQL generated ID to the milvus db. Evertime I try, I am met with an error of the type:
error inserting data into Milvus database Error: Insert fail: some field does not exist for this collection in line. 0
I generate a id in a sqldb that gets autoIncremented, then retrieve this ID when I store text in it and pass in the ID as a function parameter in the milvus db, but it won't let me pass it in, I don't know what I am doing wrong. Please help! Also, everything worked when the ID parameter was set to auto increment in my Milvus db in terms of actually storing the vectors and assigning an id. I just want to be able to manually set one myself for each vector.
Here are the code snippets for both my vectordb.js file and app.js file:
Vector db:
const schema = [
{
name: 'ID',
description: 'ID Field',
data_type: DataType.Int64,
is_primary_key: true,
autoID: false,
},
{
name: 'Vector',
description: "Vector Embeddings",
data_type: DataType.FloatVector,
dim: 1536,
},
];
await client.createCollection({
collection_name,
consistency_level: 'Strong',
fields: schema,
});
// create a function that is going to hold the data and insert it into the milvus vector database
async function insertVectorIntoMilvus(id, vector) {
const fields_data = [
{
ID: id, // Assuming
idis a single value, not an arrayVector: vector,
},
];
App.js:
async function process_batches(batches) {
for (let i = 0; i < batches.length; i++) {
// let tokensBatches = 0;
for (let j = 0; j < batches[i].length; j++) {
//encode a chunk within a batch
}
Beta Was this translation helpful? Give feedback.
All reactions