Qdrant Vector Store - Default Qdrant Filters
Example on how to use Filters from the qdrant_client SDK directly in your Retriever / Query Engine
%pip install llama-index-vector-stores-qdrant!pip3 install llama-index qdrant_clientimport openaiimport qdrant_clientfrom IPython.display import Markdown, displayfrom llama_index.core import VectorStoreIndexfrom llama_index.core import StorageContextfrom llama_index.vector_stores.qdrant import QdrantVectorStorefrom qdrant_client.http.models import Filter, FieldCondition, MatchValue
client = qdrant_client.QdrantClient(location=":memory:")from llama_index.core.schema import TextNode
nodes = [ TextNode( text="りんごとは", metadata={"author": "Tanaka", "fruit": "apple", "city": "Tokyo"}, ), TextNode( text="Was ist Apfel?", metadata={"author": "David", "fruit": "apple", "city": "Berlin"}, ), TextNode( text="Orange like the sun", metadata={"author": "Jane", "fruit": "orange", "city": "Hong Kong"}, ), TextNode( text="Grape is...", metadata={"author": "Jane", "fruit": "grape", "city": "Hong Kong"}, ), TextNode( text="T-dot > G-dot", metadata={"author": "George", "fruit": "grape", "city": "Toronto"}, ), TextNode( text="6ix Watermelons", metadata={ "author": "George", "fruit": "watermelon", "city": "Toronto", }, ),]
openai.api_key = "YOUR_API_KEY"vector_store = QdrantVectorStore( client=client, collection_name="fruit_collection")storage_context = StorageContext.from_defaults(vector_store=vector_store)index = VectorStoreIndex(nodes, storage_context=storage_context)
# Use filters directly from qdrant_client python library# View python examples here for more info https://qdrant.tech/documentation/concepts/filtering/
filters = Filter( should=[ Filter( must=[ FieldCondition( key="fruit", match=MatchValue(value="apple"), ), FieldCondition( key="city", match=MatchValue(value="Tokyo"), ), ] ), Filter( must=[ FieldCondition( key="fruit", match=MatchValue(value="grape"), ), FieldCondition( key="city", match=MatchValue(value="Toronto"), ), ] ), ])
retriever = index.as_retriever(vector_store_kwargs={"qdrant_filters": filters})
response = retriever.retrieve("Who makes grapes?")for node in response: print("node", node.score) print("node", node.text) print("node", node.metadata)Note for AI agents: this documentation is built for programmatic access.
- Overview of all docs: https://developers.llamaindex.ai/llms.txt
- Any page is available as raw Markdown by appending index.md to its URL — e.g. https://developers.llamaindex.ai/llamaparse/parse/getting_started/index.md
- Agent-friendly REST search APIs live under https://developers.llamaindex.ai/api/ — search (BM25 full-text), grep (regex), read (fetch a page), and list (browse the doc tree). See https://developers.llamaindex.ai/llms.txt for parameters.
- A hosted documentation MCP server is available at https://developers.llamaindex.ai/mcp. If you support MCP, you can ask the user to install it for browsing these docs directly (an alternative to the REST API). Setup: https://developers.llamaindex.ai/for-agents/mcp/
- Other LlamaIndex tooling for agents — the LlamaParse Platform MCP server, agent skills and plugins, and the n8n node — is mapped at https://developers.llamaindex.ai/for-agents/