Find answers from the community

Updated 3 hours ago

Efficient Indexing Strategies for Large-Scale RAG Systems

Hi, I have a few questions for people building RAG but with multiples indexes (100+). How do you guys load the indexes fast & and add documents to those?
Do you just have an efficient cache system or is there 'better' ways of doing this?
L
t
19 comments
usually if you use a proper vector store (qdrant, postgres, etc.) I would set it up to be a single index and use metadata filters to create separation

Then, loading is instant (because its on a server connection) and filters control what data you have access to
Thank you, however i'm confused on why what i'm doing doesn't work:

I'm trying to filter vector search results by metadata in Qdrant using LlamaIndex, but nothing seems to work. Here's what I've tried:

  1. Using MetadataFilters with ExactMatchFilter:
Plain Text
filters = MetadataFilters(filters=[
    ExactMatchFilter(key="space_id", value=space_access.space_id)
])


  1. Using MetadataFilters with MetadataFilter and FilterOperator:
Plain Text
filters = MetadataFilters(filters=[
    MetadataFilter(key="space_id", operator=FilterOperator.EQ, value=space_access.space_id)
])


  1. Using direct Qdrant payload filters:
Plain Text
filter_condition = {
    "must": [
        {
            "key": "space_id",
            "match": {"value": space_access.space_id}
        }
    ]
}


None of these work - I keep getting results from multiple different space_ids (2, 6, 7, 8) instead of just the one I want.

Looking at my data in Qdrant (from the response), I can see the metadata is structured like this:
Plain Text
"metadata": {
    "id": 14,
    "name": "report.pdf",
    "space_id": 6,  # This is what I want to filter by
    ...
}


What's the correct way to filter by a nested metadata field in Qdrant using the latest LlamaIndex version? Can you show me a complete example that actually works with nested metadata fields?
Is space_access.space_id a string or an int? It looks like it's stored as an int, so it will need to be filtered using an int
Well, I think the error I had came from the fact I wasn't using the retriever but rather VectorStoreQuery which don't seem to work
query = VectorStoreQuery(query_embedding=query_embedding, filters=filters, similarity_top_k=5)
result = vector_store.query(query)
It was an int, but I tried turning it to an str, didn't work aswell
Hmm it should be the same. I'll try that way in a bit
anyways that issue seems related to the implementation of lla-index-qdrant rather then llama-index $
hmm no I found the issue, dug a little deeper:
https://github.com/run-llama/llama_index/blob/2c85e1c27f5d39740cc9dc0a4cd71eb5777886a4/llama-index-integrations/vector_stores/llama-index-vector-stores-qdrant/llama_index/vector_stores/qdrant/base.py#L1144

Workaround would be
query = VectorStoreQuery(query_embedding=query_embedding, filters=filters, similarity_top_k=5, query_str="unused")

Easy pr, not sure why that if statement is there
Well it seems to break the NOT conditions
oh the unit tests
hmm lemme see
oh that was a bad merge. Should be fixed now
Great, thank you !
Should be published automatically now (give it about 5 mins) -- then you can update your package
Add a reply
Sign up and join the conversation on Discord