-
Notifications
You must be signed in to change notification settings - Fork 144
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
[LuceneOnFaiss Part-8] Added index.knn.memory_optimized_search
index setting.
#2616
base: lucene-on-faiss
Are you sure you want to change the base?
[LuceneOnFaiss Part-8] Added index.knn.memory_optimized_search
index setting.
#2616
Conversation
d53f941
to
e8b446b
Compare
src/main/java/org/opensearch/knn/index/codec/KNN990Codec/NativeEngines990KnnVectorsReader.java
Outdated
Show resolved
Hide resolved
e8b446b
to
4e34f01
Compare
Part-7 #2608 was merged. |
fbd6e65
to
fcef387
Compare
Hi @jmazanec15 , In this revision, I've included a hybrid approach inspired by @shatejas 's suggestion. Previously, I added lazy loading in search because accessing the However, this scenario is rare. In most cases, OpenSearch's internal framework (e.g., With this hybrid approach, we attempt to initialize in the constructor. If Let me know if you have any major concerns. I think this approach not only mitigates potential p99 issues but also avoids the Lucene SPI limitation. |
src/main/java/org/opensearch/knn/index/codec/KNN990Codec/NativeEngines990KnnVectorsReader.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/knn/index/codec/KNN990Codec/NativeEngines990KnnVectorsReader.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/knn/memoryoptsearch/faiss/MemoryOptimizedSearchSupportSpec.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/knn/memoryoptsearch/faiss/MemoryOptimizedSearchSupportSpec.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/knn/index/codec/BasePerFieldKnnVectorsFormat.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/knn/index/codec/BasePerFieldKnnVectorsFormat.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/knn/index/codec/KNN990Codec/NativeEngines990KnnVectorsFormat.java
Show resolved
Hide resolved
c0dc961
to
822f918
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall - couple of comments
src/main/java/org/opensearch/knn/index/codec/KNN990Codec/NativeEngines990KnnVectorsReader.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/knn/index/query/KNNQueryBuilderTests.java
Outdated
Show resolved
Hide resolved
822f918
to
6132ada
Compare
Signed-off-by: Dooyong Kim <kdooyong@amazon.com> Co-authored-by: Dooyong Kim <kdooyong@amazon.com>
6132ada
to
952723d
Compare
Description
This PR adds
index.knn.memory_optimized_search
index settings.Overall, this brings two major changes listed below along with the new setting definition:
Add 'index name' in field attributes.
In VectorReader, we check whether memory optimized search is enabled. If it is enabled, then use IndexInput to partial load FAISS index for searching. Partial loaded index hierarchy will be used for serving a query via Lucene's HNSW graph searcher.
Since this setting sits on index level, we need an index name to query whether if it's enabled or not.
To this, we inject index name into field attributes.
Branching in KNNQueryBuilder
This PR will make each knn field type decide whether memory-optimized-search is supported or not.
Currently only Float HNSW is supported, therefore any binary HNSW graphs will return
false
to indicate the feature is not supported.If target field in search is supported for memory-optimized-search, control will fallback to Lucene query to proceed vector search. In which, Lucene's HNSW graph searcher will perform KNN search + Radius search on FAISS index.
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.