The Missing ”WHERE” Clause for Vector Search
pinecone.io
pinecone.io
This is why single-stage filtering was the most-requested feature for us.
From the Opensearch docs:
> You should not use approximate k-NN if you want to apply a filter on the index before the k-NN search, which greatly reduces the number of vectors to be searched.
> Because the graphs are constructed during indexing, it is not possible to apply a filter on an index and then use this search method. All filters are applied on the results produced by the approximate nearest neighbor search.
> If you use the knn query alongside filters or other clauses (e.g. bool, must, match), you might receive fewer than k results.
(https://opensearch.org/docs/search-plugins/knn/approximate-k...)
I know Elasticsearch is working on introducing vector search but it is not yet available. I don't know how they will support filtering.
If the filtering is very narrow, as you commented they also provide functionality to perform pre-filtering and then exact kNN on the results. This is of course higher latency, but still quite acceptable for many use cases (this is how I use it).
I believe there are use cases that Pinecone addresses better than Opensearch, but I want to let people know that there is a free, open-source solution which _may_ also work for their use case.
Elasticsearch does currently support vector search through script score using dense vector fields, however I suspect they are still working on improving it and I prefer the Opensearch implementation for the time being https://www.elastic.co/guide/en/elasticsearch/reference/curr...
I realize you are hinting at it as the subject of a later article, but could you share with us a little bit more about single-stage-filtering :D ? how does it work? How can metadata and vector data "coexist" in a same index?
We know you want to know, and we also know other vector databases want to know -- because this is a highly requested feature and it's far from trivial to implement in a low-latency way. That's why we have to give the admittedly non-satisfying answer of "stay tuned!"
Did animation actually add anything significant anyway.
Please open firefox to that page, leave it open for a few minutes and observe the memory. I suspect FX will bloat too.
https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot....
Postgres does the same thing for many queries if you look at the query plan.
Not really worthy of a blog post - especially one that says "wait till the next blog post to find out how it works!!".
If it turns out that’s all pinecone have, then yeah, I’m gonna be disappointed. My mind is working overtime imagining prefixing vectors with their filter terms to root everything and other naive things…
This is not a trivial problem when dealing with vector similarity search, which Postgres does not have.
How do you handle the case where the probed clusters contain no elements satisfying the filter criteria? Is the probe extended to additional clusters, or terminated with no results?
[0] https://en.wikipedia.org/wiki/Nearest_neighbor_search
[1] https://en.wikipedia.org/wiki/K-d_tree
[2] https://en.wikipedia.org/wiki/R-tree