await index.query({
topK: 2,
vector: [ ... ],
includeMetadata: true,
includeVectors: true
}, { namespace: "my-namespace" })
/*
[
{
id: '6345',
score: 0.85,
vector: [],
metadata: {
sentence: "Upstash is great."
}
},
{
id: '1233',
score: 0.75,
vector: [],
metadata: undefined
},
]
*/
await index.query({
topK: 2,
vector: [ ... ],
includeMetadata: true,
includeVectors: true
}, { namespace: "my-namespace" })
/*
[
{
id: '6345',
score: 0.85,
vector: [],
metadata: {
sentence: "Upstash is great."
}
},
{
id: '1233',
score: 0.75,
vector: [],
metadata: undefined
},
]
*/
Hide child attributes
vector
or sparseVector
field, depending on your index type. Or you can pass the data
field and create the embeddings using Upstash Embedding.topK
vectors will be returned.true
would be the best practice, since it will make it easier to
identify the vectors.RRF
.HYBRID
.Hide child attributes
Hide child attributes
includeVectors
is set to true)includeVectors
is set to true)includeMetadata
is set to true)includeData
is set to true)await index.query({
topK: 2,
vector: [ ... ],
includeMetadata: true,
includeVectors: true
}, { namespace: "my-namespace" })
/*
[
{
id: '6345',
score: 0.85,
vector: [],
metadata: {
sentence: "Upstash is great."
}
},
{
id: '1233',
score: 0.75,
vector: [],
metadata: undefined
},
]
*/
Was this page helpful?