Skip to main content
GraphRAG offers three distinct search methods, each optimized for different types of queries. This guide helps you understand when to use each method and how they compare.

Search methods overview

Global search

Map-reduce over community reportsBest for high-level, dataset-wide questions and thematic analysis.

Local search

Entity-centric retrievalBest for specific entity queries and detailed fact retrieval.

DRIFT search

Iterative graph traversalBest for complex multi-hop reasoning and exploratory analysis.

Quick comparison table

AspectGlobal SearchLocal SearchDRIFT Search
Question TypeBroad, thematicSpecific, factualComplex, multi-hop
Data SourceCommunity reportsEntities + text + reportsDynamic graph traversal
Context BuildingFixed (all reports at level)Semantic retrievalIterative expansion
LLM CallsMany (map-reduce)SingleMultiple (iterative)
CostHighLow-MediumMedium-High
Response TimeSlow (2-10s)Fast (<2s)Medium (2-5s)
Token UsageHighLow-MediumMedium-High
CoverageEntire datasetFocusedAdaptive
DepthSummarizedDetailedMulti-level

When to use each method

  • “What are the main themes in this dataset?”
  • “What are the top trends across all documents?”
  • “Summarize the key findings”
  • “What are the most significant events?”
  • “How do different topics relate globally?”
  • “Who is Dr. Jordan Hayes?”
  • “What is the relationship between X and Y?”
  • “What are the properties of this entity?”
  • “When did this specific event occur?”
  • “What does the document say about X?”
  • “How do organizations influence these events?”
  • “What chain of events connects A to B?”
  • “What patterns emerge from analyzing X, Y, and Z together?”
  • “How are these entities indirectly connected?”
  • “What are the multi-step dependencies?”

Side-by-side examples

Here’s how each method handles the same dataset but different query types:

Dataset: “Operation Dulce” (sci-fi narrative)

Question: “What are the main themes in this story?”
Response: Analyzes all community reports to identify overarching themes like government secrecy, alien contact, scientific ethics, and human cooperation.Why it works: Synthesizes information across the entire narrative structure.Cost: ~15,000 tokens
Question: “Who is Agent Mercer and what is their role?”
Response: Retrieves Agent Mercer entity, related relationships, and relevant text chunks providing detailed information about their role, background, and actions.Why it works: Direct entity retrieval with supporting evidence.Cost: ~2,500 tokens
Question: “How do the government organizations indirectly influence the scientific research at the base?”
Response: Traces connections from government entities through intermediary actors to research activities, revealing multi-step influence patterns.Why it works: Designed for graph traversal and multi-hop reasoning.Cost: ~7,000 tokens
Question: “What is the relationship between Dr. Hayes and the Dulce facility?”
Response: Retrieves both entities and their connecting relationships with supporting text evidence.Why it works: Optimized for entity relationship queries.Cost: ~2,800 tokens

Decision flowchart

1

Is your question about a specific entity or relationship?

YES → Use Local SearchExamples:
  • “Who is X?”
  • “What is X’s relationship to Y?”
  • “What are X’s properties?”
NO → Continue to next step
2

Does your question require understanding the entire dataset?

YES → Use Global SearchExamples:
  • “What are the main themes?”
  • “What are the key trends?”
  • “Summarize this dataset”
NO → Continue to next step
3

Does your question involve multi-hop reasoning or complex connections?

YES → Use DRIFT SearchExamples:
  • “How does X indirectly affect Y?”
  • “What chain of events connects A to B?”
  • “What patterns involve X, Y, and Z?”
NO → Try Local Search first, then escalate if needed

Hybrid approaches

You can combine search methods for comprehensive analysis:

Sequential querying

1

Start with global search

Get high-level themes and important entities:
graphrag query "What are the main entities in this dataset?" --method global
2

Follow up with local search

Deep dive into specific entities identified:
graphrag query "Tell me more about [entity from global results]" --method local
3

Use DRIFT for connections

Explore relationships between key entities:
result = await drift_search.search(
    "How do [entity1] and [entity2] influence each other?"
)

Validation strategy

# Use multiple methods to validate findings

# Global: Identify main themes
global_result = await global_search.search(
    "What are the key themes?"
)

# Local: Verify themes with specific evidence
local_result = await local_search.search(
    "What evidence supports the theme of [X]?"
)

# DRIFT: Explore how themes connect
drift_result = await drift_search.search(
    "How do themes [X] and [Y] relate through entities?"
)

Performance benchmarks

Based on typical “Operation Dulce” dataset queries:
MetricGlobalLocalDRIFT
Avg Response Time8.5s1.2s3.8s
Avg Tokens (Prompt)11,5002,8006,200
Avg Tokens (Output)800400600
Avg Cost (GPT-4)$0.12$0.03$0.07
ParallelizableYesNoPartially
Actual performance varies based on dataset size, query complexity, and configuration parameters.

Configuration comparison

Cost optimization strategies

Use local search first

Start with low-cost local search; escalate only if needed

Adjust community level

Use level 1 for global search instead of level 2 to reduce tokens

Tune DRIFT conservatively

Keep n_depth=2 and drift_k_followups=2 for most queries

Use summaries

Set use_community_summary=True in global search

Common pitfalls

Problem: Expensive and provides less detail than local search.Solution: Use local search for entity-specific queries.
Problem: May miss important information not connected to retrieved entities.Solution: Use global search for dataset-wide questions.
Problem: Setting n_depth=5 and drift_k_followups=10 wastes tokens.Solution: Start with default parameters and increase only if needed.
Problem: Accepting answers without verifying supporting evidence.Solution: Always inspect result.context_data to see what was used.

Choosing based on use case

Primary: Global search for themes and patternsSecondary: Local search for validating specific claimsTertiary: DRIFT search for exploring connections between findings

Next steps

Global search

Deep dive into global search

Local search

Master local search techniques

DRIFT search

Learn DRIFT search methods

Query overview

Complete query documentation

Build docs developers (and LLMs) love