alexklibisz / elastik-nearest-neighbors

Go to: https://github.com/alexklibisz/elastiknn
https://github.com/alexklibisz/elastiknn
250 stars 62 forks source link

How can i search similar images by vector in _aknn_search? #11

Open arpsyapathy opened 5 years ago

arpsyapathy commented 5 years ago

Hello!

For example, i have index base and i have one vector of image for search similar of it.

How can i search similar images by vector in _aknn_search?

How to pass a vector for search by /_aknn_search?

I don.t understand from README...

Help me please. Thank you advance

SthPhoenix commented 5 years ago

Hi! It's not possible in original plugin at the moment, but you can try my fork.

It has _aknn_search_vec endpoint, which can be used like this:

 ```
 POST <elasticsearch host>:9200/_aknn_search_vec

 {
     "_index":       "twitter_images",
     "_type":        "_doc",
     "_aknn_uri":    "aknn_models/_doc/twitter_images"
     "query_aknn": {
             "_aknn_vector": [0.12, 0.23, ...],
             "k1":1000,
             "k2":100
      }, 
      "filter":{
           "range":{
              "post_date":{
                     "gte":"now-1d"
              }  
           }
      }
 }
 ```

As you can see it also supports filter context. Also it has pre-compiled binaries for ES 6.4.1-6.5.4

arpsyapathy commented 5 years ago

@SthPhoenix Thank you!!