toptal / chewy

High-level Elasticsearch Ruby framework based on the official elasticsearch-ruby client
MIT License
1.88k stars 366 forks source link

Add KNN #890

Closed jkostolansky closed 9 months ago

jkostolansky commented 1 year ago

Add the KNN option to the request.

PlacesIndex.knn(field: :vector, query_vector: [4, 2], k: 5, num_candidates: 50)
# => <PlacesIndex::Query {..., :body=>{:knn=>{"field"=>:vector, "query_vector"=>[4, 2], "k"=>5, "num_candidates"=>50}}}>
tomdev commented 9 months ago

This sounds like a great feature addition! Is there anything we need to do before this PR can get reviewed?

konalegi commented 9 months ago

Folks, sorry for the long absence, is this feature still legit?

konalegi commented 9 months ago

@jkostolansky could you please rebase with master and update your branch? (ofc as long as you need this PR)

jkostolansky commented 9 months ago

@konalegi Sure, it's rebased. Thanks!

konalegi commented 9 months ago

hey @jkostolansky your changes has been release https://rubygems.org/gems/chewy/versions/7.3.6

jkostolansky commented 9 months ago

Thank you, @konalegi 🙌