I am using vector search :
{
$vectorSearch: {
queryVector: embedding,
path: 'plot_embedding',
numCandidates: 10000,
limit: 10,
index: 'vector_index',
},
},
{
$group: {
_id: null,
docs: { $push: '$$ROOT' },
},
},
{
$unwind: {
path: '$docs',
includeArrayIndex: 'rank',
},
},
// {
// $addFields: {
// vs_score: { // add prres 3
// $divide: [1.0, { $add: ['$rank', vector_penalty, 1] }],
// },
// },
// },
{
$addFields: {
vs_score: {
$round: [{
$divide: [1.0, { $add: ['$rank', vector_penalty, 1] }]
}, 3]
}
}
},
{
$project: {
vs_score: 1,
_id: '$docs._id',
name: '$docs.name',
summary: '$docs.summary',
website_url: '$docs.website_url',
},
},
I want get the keyword from each retrieved record, based on which the vector search has decided that this record is related to the actual searchKeyword. On mongo atlas vecor search Index, I have created embeddings for summary,technologies,name,clients fields only. for example if i search for “human health”. I get one record which has “human health” word in its summary field, I get another record which contains “human heart” related info in its summary (so vector search is giving results based on related keywords or meanings). Hence I want those keywords from each record : [“human health”, “human heart”]