Skip to main content
Global search generates answers by analyzing all AI-generated community reports in a map-reduce fashion. This method is ideal for questions that require understanding of the dataset as a whole.
This page references the global_search.ipynb notebook from the GraphRAG repository.
Global search is best suited for:
  • High-level questions - “What are the main themes?”
  • Dataset-wide insights - “What are the most significant trends?”
  • Comparative analysis - “How do different communities relate?”
  • Summarization tasks - “What is this dataset about?”

How global search works

1

Community report retrieval

Global search loads all community reports generated during indexing. These reports summarize clusters of related entities and relationships.
2

Map phase

Each community report is sent to the LLM with your question, generating intermediate answers from different parts of the knowledge graph.
3

Reduce phase

Intermediate answers are aggregated and synthesized into a final, comprehensive response.

Setting up the notebook

Import required libraries

Configure language models

Load community reports

The COMMUNITY_LEVEL parameter controls granularity. Higher values use more detailed community reports but increase computational cost.

Build global context

Configure search parameters

Create search engine

Inspect context data

Analyze token usage

Example queries

Tuning parameters

Community level selection

  • Fewest communities
  • Broadest summaries
  • Lowest cost
  • Best for very high-level questions

Response type options

Performance optimization

Parallel processing

Increase concurrent_coroutines for faster map phase

Token management

Adjust max_tokens based on your model limits

Community filtering

Set minimum rank to skip low-importance communities

Summary mode

Use summaries instead of full reports to reduce tokens
AspectGlobal SearchLocal Search
Question TypeHigh-level, broadSpecific, detailed
Data SourceCommunity reportsEntities + text chunks
CostHigher (map-reduce)Lower (single query)
Response TimeSlowerFaster
Best ForThemes, trends, summariesEntity details, relationships

Next steps

Local search

Learn about local search for specific queries

DRIFT search

Explore hybrid search methods

Search comparison

Compare all search methods

Query guide

Complete global search documentation