Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Is it possible to execute an approximate nearest neighbour search by using the document id as a parameter? #467

Closed
olsi-qose opened this issue Apr 6, 2021 · 4 comments

Comments

@olsi-qose
Copy link

olsi-qose commented Apr 6, 2021

In the docs it is specified that the knn query can be used to search nearest neighbours.

GET my-knn-index-1/_search
{
  "size": 2,
  "query": {
    "knn": {
      "my_vector2": {
        "vector": [2, 3, 5, 6],
        "k": 2
      }
    }
  }
}

The dimensionality of the data is approximately 1300 embeddings. I was wondering if it is possible to query knn results by passing the id of the ES document instead of the whole vector?

@aetter
Copy link
Contributor

aetter commented Apr 6, 2021

Hi @olsi-qose not as far as I know -- I believe you have to get the document you want first and then pass over the appropriate field as your query -- but I've tagged a couple people who are more knowledgeable than me. @jmazanec15 @vamshin.

@olsi-qose
Copy link
Author

Thank you @aetter!

@jmazanec15
Copy link
Contributor

Hi @olsi-qose, at the moment, we do not support this. But it is an interesting use case. I will create an issue in the k-NN repo for investigation.

@aetter
Copy link
Contributor

aetter commented Apr 28, 2021

Closing this out in favor of opendistro-for-elasticsearch/k-NN#341.

@aetter aetter closed this as completed Apr 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants