-
Notifications
You must be signed in to change notification settings - Fork 801
Does elasticsearch-dsl-py support knn_search? #1679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello! Glad that you're happy with elasticsearch-dsl-py 8.x. Note that the page you linked to mentions that I may get to it in the future, but for now I'm happy to receive contributions! |
Thank you very much for clarifying! (I completely missed the deprecation note until you have pointed it out) The collapse implementation is one way for sure! I am very fond of the syntax offered by the Q shortcut and wonder if a knn type could be added to it as well. But unfortunately at this very moment I haven't thought through how exactly the syntax could look like for a Q shortcut that does ANN search. So I look forward to seeing how things turn out for #1649, and in the meantime, I will think about how this may look like for the Q shortcut and come back with a more specific proposal (and if possible, to also help contribute). Thanks! |
@honzakral Any opinion on Search vs Q? |
@pquentin A |
Appreciate the discussion! :) One quick question to @honzakral: what about a potential use case of combining lexical matching with knn via an OR condition in the context of lexical-vector hybrid? |
@shandou based on https://www.elastic.co/guide/en/elasticsearch/reference/current/knn-search.html#_combine_approximate_knn_with_other_features I'd say the natural way would be to just define both s = Search(index="...")
s = s.query("match", whatever_field="some query")
s = s.knn(filter=Q("terms", tags=["why", "not", "filter", "knn", "too", ":)"]), ...) It might not be the simplest expression, but it mirrors exactly the logic of the dsl where different options in the |
Great to see that this package now supports 8+ versions of Elasticsearch ❤️
However, when perusing the documentation, I am not yet seeing explicit support to knn_search similar to the lower-level python client. Curious about:
Thank you very much!
The text was updated successfully, but these errors were encountered: