> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Milvus Hybrid Search

> Combine dense embeddings and sparse keyword vectors in one Milvus search with SearchType.hybrid.

## Code

```python milvus_db_hybrid_search.py theme={null}
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.vectordb.milvus import Milvus, SearchType

vector_db = Milvus(
    collection="recipes", uri="/tmp/milvus_hybrid.db", search_type=SearchType.hybrid
)

knowledge = Knowledge(
    vector_db=vector_db,
)

knowledge.insert(
    url="https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf",
)

agent = Agent(knowledge=knowledge)
agent.print_response("How to make Tom Kha Gai", markdown=True)
```

## Usage

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U pymilvus pypdf openai agno
```

**2. Set environment variables**

```bash theme={null}
export OPENAI_API_KEY=xxx
```

**3. Run Agent**

```bash theme={null}
python milvus_db_hybrid_search.py
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.