elastic / elasticsearch-py

Official Python client for Elasticsearch
https://ela.st/es-python
Apache License 2.0
37 stars 1.18k forks source link

Vectorstore: use a retriever query for hybrid search #2666

Closed miguelgrinberg closed 1 month ago

miguelgrinberg commented 2 months ago

Fixes #2651

github-actions[bot] commented 2 months ago

A documentation preview will be available soon.

Request a new doc build by commenting * Rebuild this PR: `run docs-build` * Rebuild this PR and all Elastic docs: `run docs-build rebuild` `run docs-build` is much faster than `run docs-build rebuild`. A `rebuild` should only be needed in rare situations. If your PR continues to fail for an unknown reason, the doc build pipeline may be broken. Elastic employees can check the pipeline status [here](https://buildkite.com/elastic/docs-build).
miguelgrinberg commented 1 month ago

I did not consider the case of rrf = False, I just assumed that rrf = False means that hybrid search is off, but now I realize that we have two booleans.

I'm not sure what would be the expected response when having hybrid search enabled and RRF disabled. Does that even make sense? I guess I need to try it out to see what response I get.

miguelgrinberg commented 1 month ago

@pquentin Okay, new revision of this fix. When the user asks for hybrid=True and rrf=False we use a regular query with knn and query sections in the body. Only when rrf=True or rrf=dict(<rrf-options>) we use the new retriever query.