Find answers from the community

Updated 3 months ago

How to add multiple values to metadata filter for a single key (eg:filename)


How to add multiple values to metadata filter for a single key (eg:filename)
k
2 comments
Please stand by @Arav as I search the knowledge base. I normally take about 20 seconds or so. :wave:
----------------------
I'm sorry, but the information extracts provided do not contain specific instructions or examples on how to add multiple values to a metadata filter for a single key using LlamaIndex. The examples provided only demonstrate filtering with exact match for a single key-value pair.

However, you can typically use multiple ExactMatchFilter instances with the same key but different values in the MetadataFilters list. Here's a hypothetical example:

Plain Text
from llama_index.vector_stores.types import ExactMatchFilter, MetadataFilters

filters = MetadataFilters(filters=[
    ExactMatchFilter(key="filename", value="file1.txt"),
    ExactMatchFilter(key="filename", value="file2.txt")
])


Please note that this is a hypothetical example and may not work as expected. For accurate information, I recommend referring to the official LlamaIndex documentation or source code.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord