Local atlas vector search returns 0 docs

I upgraded my atlas local deployment to 7.0.4 and am running commands through mongosh for maximum simplicity.

My index is this:

>> db.getCollection("_my.collection").getSearchIndexes()
[
  {
    id: '656764e39caaaa2038fc5689',
    name: '_my.vsi',
    status: 'READY',
    queryable: true,
    latestVersion: 0,
    latestDefinition: {
      name: '_my.vsi',
      mappings: {
        dynamic: true,
        fields: {
          'up.stream.embedding.vector': { type: 'knnVector', dimensions: 768, similarity: 'cosine' }
        }
      }
    }
  }
]

When I aggregate with the query:

>> db.getCollection("_my.collection").aggregate([{
  "$vectorSearch": {
    "queryVector": [...exactly the floats from one of the records...],
    "numCandidates": 10,
    "limit": 10,
    "path": "up.stream.embedding.vector",
    "index": "_my.vsi"
  }
}])

I get zero results, despite my collection having 6 documents with a 768-length array of bson doubles at the path “up.stream.embedding.vector”. That path does not include indexing through arrays of objects/documents.

What am I doing wrong here?

I’m pretty sure this just doesn’t work on nested fields of any kind. Exploring with toy examples, it worked when the field was on the record’s base level, but not when the field was nested at all.

Hi Peter!

Apologies for the inconvenience here. You are correct that we don’t currently support indexing and querying vectors that are nested. We are looking at adding this to our roadmap in the near future, but in the meantime you will have to have this field at the root level of your collection.

I will make a note to make it more clear in both the $search knnBeta documentation and $vectorSearch documentation that this isn’t supported today. Let me know if I can help in any other way!

2 Likes

Nope, that’s it! Thank you

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.