Skip to content
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

Refactor true radial search to be its own query type #1879

Open
jmazanec15 opened this issue Jul 25, 2024 · 0 comments
Open

Refactor true radial search to be its own query type #1879

jmazanec15 opened this issue Jul 25, 2024 · 0 comments
Labels
Refactoring Improve the design, structure, and implementation while preserving its functionality

Comments

@jmazanec15
Copy link
Member

Description

For radial search, we added max_distance and min_score parameters to specify that we should fetch all results from the ANN index within that threshold. This is then limited by the size parameter for how many results are returned.

I think we should separate this functionality into its own query that looks something like:

GET my-rnn-index-1/_search
{
  "size": 2,
  "query": {
    "rnn": {
      "my_vector2": {
        "vector": [2, 3, 5, 6],
        "max_distance": 2
      }
    }
  }
}

For the k-NN query, we can keep the score/distance thresholds, but for these, the user would still need to specify k as the max number of neighbors and then we would do the distance filter after. So, k would just mean, return up to k results.

The reason I think that they should be separate queries is that they are separate problems with different solution requirements and keeping them under the same query type is misleading and potentially limiting from an implementation standpoint. Radial queries should be built to support a large number of potential matches, while k-NN queries have a hard limit on the total number of results to be returned. Thus, they should be housed under different query types.

@jmazanec15 jmazanec15 added Refactoring Improve the design, structure, and implementation while preserving its functionality and removed untriaged labels Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactoring Improve the design, structure, and implementation while preserving its functionality
Projects
Status: Backlog
Development

No branches or pull requests

1 participant