Searching named vectors from the Javascript graphQL client

Description

I couldn’t find any information for running a nearVector search using the javascript graphQL client when querying a named vector

for a non-named vector, the query would look like this (below):

const response = await client.graphql
  .get()
  .withClassName('Publication')
  .withFields('name _additional {certainty}')
  .withNearVector({
    vector: [0.1, -0.15, 0.3, ... ]   
  })
  .do();
console.log(response);

Can someone share a sample code showing how a target vector can be specified by name?

Server Setup Information

  • Weaviate Server Version: 1.25.2
  • Deployment Method: weaviate.io
  • Multi Node? Number of Running Nodes:
  • Client Language and Version: js/ts
  • Multitenancy?: yes

Any additional Information

hi @Hugo !

Welcome to our community :hugs:

Check an example here:

For instance:

  var result = await client.graphql
  .get()
  .withClassName('WineReviewNV')
  .withNearVector({
    vector: [1,2,3,4],
    targetVectors: ['title_country'],
  })
  .withLimit(2)
  .withFields('title review_body country')
  .do();

Notice that this is the typescript v2 version, while we already have the v3 that is way better on pretty much all features :wink:

Check here more info on that:

Let me know if this helps!

Thanks!