Search
Search your Store using natural language to find exactly what you need. Stores understand the meaning behind your queries, not just keywords, making it perfect for conversational search and complex questions.
Basic Search
Search for chunks of content across your Store:
from mixedbread import Mixedbread
mxbai = Mixedbread(api_key="YOUR_API_KEY")
response = mxbai.stores.search(
query="How does authentication work?",
store_identifiers=["my-knowledge-base"],
top_k=5,
)
for chunk in response.data:
print(chunk)When you search, Stores understand your natural language query and find the most relevant content across all your files. Results are automatically ranked by relevance with confidence scores.
For complete details on chunk object structure including all content types and properties, see Data Models.
Search Options
Top-k Results
Control the number of results returned:
results1 = mxbai.stores.search(
query="API authentication methods",
store_identifiers=["docs"],
top_k=5
)
results2 = mxbai.stores.search(
query="deployment strategies",
store_identifiers=["docs"],
top_k=20
)Optimization Tips:
- Start with
top_k=10for most use cases - Increase for comprehensive searches
- Decrease for faster response times
Filter
Filter search results to narrow down your search scope. Store search supports two types of filtering:
results = mxbai.stores.search(
query="user authentication",
store_identifiers=["docs"],
filters={
"all": [
{"key": "category", "operator": "eq", "value": "documentation"},
{"key": "difficulty", "operator": "in", "value": ["beginner", "intermediate"]}
]
}
)For complete metadata filtering capabilities and advanced patterns, see Metadata Filtering.
results1 = mxbai.stores.search(
query="authentication methods",
store_identifiers=["docs"],
file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"]
)
results2 = mxbai.stores.search(
query="authentication methods",
store_identifiers=["docs"],
file_ids=("in", ["123e4567-e89b-12d3-a456-426614174000"])
)
results3 = mxbai.stores.search(
query="authentication methods",
store_identifiers=["docs"],
file_ids=("not_in", ["123e4567-e89b-12d3-a456-426614174000"])
)Rerank
Improve search result quality by reranking results with specialized models:
results = mxbai.stores.search(
query="API rate limiting best practices",
store_identifiers=["docs"],
search_options={
"rerank": True
}
)Reranking applies a second-stage ranking model to improve relevance, especially useful for complex queries or when initial results need refinement. You can use simple boolean (True) or configure advanced options with model selection and metadata inclusion.
Learn more about Rerank for advanced reranking strategies and model options.
Multi Store Search
Search across multiple Stores simultaneously:
results = mxbai.stores.search(
query="machine learning deployment",
store_identifiers=[
"documentation",
"research-papers",
"tutorials",
"code-examples"
],
top_k=15
)Considerations:
- Results are merged and re-ranked together
- May need higher top_k for diverse results
- Different Stores may have different metadata schemas
Agentic Search
Boost the search quality by utilizing an agent that searches your store. Sometimes just one search is not enough, e.g. when asking a question that needs multiple sources to be ansered. Mixedbreads Agentic Search automatically refines your search query and performs as many searches as needed to answer your input query, all with one config:
from mixedbread import Mixedbread
mxbai = Mixedbread(api_key="YOUR_API_KEY")
results = mxbai.stores.search(
query="What are the yearly numbers for 2020, 2021, 2022, 2023, 2024, 2025?",
store_identifiers=["yearly-reports"],
search_options={
"agentic": True
}
)
print(results)The output will be the same as the normal search.
Custom settings can also be configured:
from mixedbread import Mixedbread
mxbai = Mixedbread(api_key="YOUR_API_KEY")
results = mxbai.stores.search(
query="What are the yearly numbers for 2020, 2021, 2022, 2023, 2024, 2025?",
store_identifiers=["yearly-reports"],
search_options={
"agentic": {
"max_rounds": 3,
"queries_per_round": 3,
"results_per_query": 5,
}
}
)
print(results)Web Search
Search the web using the same API by including mixedbread/web as a store identifier. You can use it standalone or combine it with your own stores for hybrid search that merges web results with your internal knowledge base.
from mixedbread import Mixedbread
mxbai = Mixedbread(api_key="YOUR_API_KEY")
results = mxbai.stores.search(
query="latest AI research papers",
store_identifiers=["mixedbread/web", "internal-docs"],
top_k=10,
)
print(results)For detailed web search capabilities and response format, see Web Store.