How do I get k nearest neighbors from a numerical vector based index?

Say I indexed something like this:



And I have a dictionary as {'l1':[2,3,4,5]}

and I want to find k values of 'l1' which are nearest in the vector space to it, how do I go about this? Is this possible to do in elasticsearch?

I'm using the python API

you may want to read about the new vector datatype that has been recently added.

In addition it might help, if your clear up your question a bit? Are the above separate documents? Is 2,3,4,5 your query vector?

A fully fledged example with sample documents might help to understand the setting a bit more.

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