Skip to content

Conversation

@iverase
Copy link
Contributor

@iverase iverase commented Nov 19, 2025

It saves some vector operations by:

  • Checking if there is any non filtered centroid when scoring children centroids
  • No scoring the parents if we are going to collect all centroids

@iverase iverase requested a review from benwtrent November 19, 2025 16:36
@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Nov 19, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

private final LongAccumulator accumulator;

IVFKnnSearchStrategy(float visitRatio, LongAccumulator accumulator) {
public IVFKnnSearchStrategy(float visitRatio, LongAccumulator accumulator) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need this on test to increase the visit ratio

Copy link
Member

@benwtrent benwtrent left a comment

Choose a reason for hiding this comment

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

This should improve things nicely! Do you have any benchmarks?

@iverase
Copy link
Contributor Author

iverase commented Nov 20, 2025

Benchmarks show a slight improvement:

Before:

index_name       index_type  visit_percentage(%)  latency(ms)  net_cpu_time(ms)  avg_cpu_count     QPS  recall    visited  filter_selectivity
---------------  ----------  -------------------  -----------  ----------------  -------------  ------  ------  ---------  ------------------ 
wiki1024en.docs         ivf                 0.00         5.44              0.00           0.00  183.82    0.97    4110.61              0.0100
wiki1024en.docs         ivf                 0.00         5.75              0.00           0.00  173.91    0.97    2515.54              0.0050
wiki1024en.docs         ivf                 0.00         6.85              0.00           0.00  145.99    0.97    1932.36              0.0025
wiki1024en.docs         ivf                 0.00         5.48              0.00           0.00  182.48    1.00    1500.43              0.0010
wiki1024en.docs         ivf                 0.00         1.82              0.00           0.00  549.45    1.00     496.00              0.0003

After:

index_name       index_type  visit_percentage(%)  latency(ms)  net_cpu_time(ms)  avg_cpu_count     QPS  recall    visited  filter_selectivity
---------------  ----------  -------------------  -----------  ----------------  -------------  ------  ------  ---------  ------------------ 
wiki1024en.docs         ivf                 0.00         5.49              0.00           0.00  182.15    0.97    4110.61              0.0100
wiki1024en.docs         ivf                 0.00         5.65              0.00           0.00  176.99    0.97    2515.54              0.0050
wiki1024en.docs         ivf                 0.00         5.75              0.00           0.00  173.91    0.97    1932.36              0.0025
wiki1024en.docs         ivf                 0.00         5.17              0.00           0.00  193.42    1.00    1500.43              0.0010
wiki1024en.docs         ivf                 0.00         1.56              0.00           0.00  641.03    1.00     496.00              0.0003

@iverase iverase merged commit 1967753 into elastic:main Nov 20, 2025
34 checks passed
@iverase iverase deleted the centroid_filtering_extra branch November 20, 2025 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>non-issue :Search Relevance/Vectors Vector search Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants