opendistro-for-elasticsearch / k-NN

🆕 A machine learning plugin which supports an approximate k-NN search algorithm for Open Distro.
https://opendistro.github.io/
Apache License 2.0
277 stars 55 forks source link

Does the knn field support array values? #266

Closed wrkaiser closed 3 years ago

wrkaiser commented 3 years ago

eg. { "my_vector1" : [[1.5, 2.5], [2, 3], [3.5, 5]], "price":10 }

vamshin commented 3 years ago

Hi @wrkaiser, at this point we do not support array values. You could add multiple fields in the index and add vectors in a single document. If you are looking into index into a single field, then every document should have one vector

wrkaiser commented 3 years ago

Thx~~ I considered that you said, but the number of value is not fixed.

vamshin commented 3 years ago

Sorry what do you mean by number of value is not fixed?

wrkaiser commented 3 years ago

The length of array no fixed.

example,~ doc1: {"my_vector1" : [[1.5, 2.5], [2, 3], [3.5, 5]]} doc2: {"my_vector1" : [ [2, 7], [3, 3]]}

vamshin commented 3 years ago

You will add one vector per document i.e each element of array which is a vector will be indexed in one document of Elasticsearch. As the number of vectors increase documents would increase.

wrkaiser commented 3 years ago

thank you, i get~