Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Conversation

@aetter
Copy link
Contributor

@aetter aetter commented Oct 21, 2020

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@aetter aetter added the upcoming release Don't merge until the version or feature is available label Oct 21, 2020
}
```

If you *only* want to use KNN's custom scoring, you can omit `"index.knn": true`, but you lose the ability to perform standard KNN queries on the index. The benefit of this approach is faster indexing speed and lower memory usage.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we change to below?

The benefit of this approach is minimal search latencies as the graphs are prebuilt with provided vectors during indexing and then cached for later queries.

Copy link
Contributor Author

@aetter aetter Oct 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the goal here was actually to talk about the benefit of a false setting. I can tweak the wording there since that wasn't clear.

Anyway, let me know if I actually resolved your concern here or if I'm just not getting it. 😄

}
```

In this case, `k` is the number of neighbors you want the query to return, but you must also include the `size` option. Otherwise, you get `k` results for each shard (and each segment) rather than `k` results for the entire query. The plugin supports a maximum `k` value of 10,000.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that size and k should always have the same value?

## Custom scoring

The [previous example](#mixing-queries) shows a search that returns fewer than `k` results. If you want to avoid this situation, KNN's custom scoring option lets you essentially invert the order of events.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this imply that if the filter option reduces the number of results below the value of k, then the filter doesn't take effect?

@aetter aetter merged commit 0cfa0d6 into master Oct 27, 2020
@aetter aetter deleted the knn-custom-scoring branch January 23, 2021 03:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

upcoming release Don't merge until the version or feature is available

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants