Skip to content
AnswerWell geo Documentation

Research · 7 min read · Answerwell

Managed Semantic Search: Instances, Data Sources, Indexing, and Hybrid Query

How Cloudflare AI Search instances ingest content, index for hybrid retrieval, and how to create, sync, and query them from CLI, Workers, and REST.

This page summarizes Cloudflare AI Search documentation: a managed service that indexes your documents or connected sources and answers natural-language queries without you operating a full retrieval stack. You create an instance, attach a data source or upload files, wait for indexing, then call Search or Chat Completions from the dashboard, Wrangler CLI, Workers binding, or REST API.

What an AI Search instance is and when you need one

Section titled “What an AI Search instance is and when you need one”

An AI Search instance is an isolated search index with its own configuration, storage, and query endpoints. Cloudflare describes the product as the search primitive for applications and agents: you give it data, and it indexes that data for natural language queries.

The search primitive for your applications and agents.

— Cloudflare, AI Search overview

Typical situations: documentation or internal knowledge search, RAG-style agents that need grounded retrieval, or multi-tenant apps where each tenant uploads files into a dedicated instance. AI Search is generally available with usage-based billing from November 1, 2026; see Limits & pricing for included monthly usage and rates.

Two core processes drive every instance:

AI Search consists of two core processes:

Indexing: An asynchronous process that converts your content into vectors and keyword indexes for search. Indexing runs automatically when you connect a data source or upload files. Querying: A synchronous process triggered by user queries. It retrieves the most relevant content using vector search, keyword search, or both, and optionally generates a response.

— Cloudflare, How AI Search works

New instances use hybrid search by default (vectors plus keywords). Workers AI embedding and reranking calls made by AI Search are included in AI Search pricing and do not appear on your Workers AI bill or in AI Gateway logs; generation, query rewriting, and external providers still bill through your account and gateway.

Data sources: built-in storage, website, and R2 bucket

Section titled “Data sources: built-in storage, website, and R2 bucket”

Every instance includes built-in storage and a built-in vector index (backed by R2 and Vectorize under the hood—you do not provision those yourself for uploads).

Every AI Search instance comes with built-in storage and a built-in vector index, powered by R2 and Vectorize. You can upload files directly to an instance without setting up either service yourself.

— Cloudflare, Built-in storage

You can also connect an external data source at creation time (not editable afterward for website/R2 per Configuration):

Data source Role Indexing timing
Built-in storage Upload via Items API, dashboard, or Workers Indexed immediately on upload
Website Crawl a domain you own Sync jobs on a schedule (default every 6 hours)
R2 bucket Index objects in a bucket Sync jobs on a schedule

An instance can use built-in storage alongside an external data source.

— Cloudflare, Built-in storage

Website crawls require the domain to be onboarded to your Cloudflare account. R2 may need a service API token on first use (token_id in create requests—see REST API get started). Crawled website pages are stored in built-in storage automatically (Website data source).

Create an instance: dashboard, Wrangler, REST, or Workers

Section titled “Create an instance: dashboard, Wrangler, REST, or Workers”

Wrangler: first instance and optional website crawl

Section titled “Wrangler: first instance and optional website crawl”

Wrangler get started and Add search to your website use the same pattern:

  1. Create the instance (built-in only, or with a web crawler source):

    wrangler ai-search create my-instance
    wrangler ai-search create my-search --type web-crawler --source <YOUR_DOMAIN>
  2. Check indexing progress:

    wrangler ai-search stats my-instance
  3. Test a query:

    wrangler ai-search search my-instance --query "What is this site about?"

Replace <YOUR_DOMAIN> with a domain onboarded to your Cloudflare account. To create an instance without a data source and upload files yourself instead, run npx wrangler ai-search create my-search --type builtin and add content from the dashboard.

— Cloudflare, Add search to your website

The interactive create wizard can also pick r2 or web sources; non-interactive example from the changelog:

wrangler ai-search create my-instance --type r2 --source my-bucket

Full flags (--chunk-size, --hybrid-search, --custom-metadata, and others) are documented under Wrangler commands.

From Dashboard get started: open AI Search, Create Instance, name it, optionally connect website or R2, then use the Items tab to upload files. After indexing, use the Playground tab (Chat or Search) to test queries.

REST: POST to create an instance in a namespace (Instances REST API, API get started).

Workers namespace binding example for upload-then-search (changelog / bindings):

const instance = env.AI_SEARCH.get("my-instance");
const item = await instance.items.uploadAndPoll("faq.md", content);
const results = await instance.search({
messages: [{ role: "user", content: "onboarding guide" }],
});

Indexing: uploads, sync jobs, and keeping content fresh

Section titled “Indexing: uploads, sync jobs, and keeping content fresh”

Built-in uploads queue processing; items.upload() returns quickly while indexing runs in the background (Items Workers binding). Use items.uploadAndPoll() or wait_for_completion: true in the Python SDK when you must search immediately after upload (Python SDK, LangChain guide).

For website and R2 sources, AI Search runs sync jobs on a schedule (every 6 hours by default) to pick up new, modified, or deleted files (Syncing).

You can trigger sync sooner from CI/CD or a CMS webhook:

wrangler ai-search jobs create my-instance

Sync jobs can be triggered at most once every 30 seconds. Job commands: create, list, get, cancel, logs—see Manage AI Search sync jobs with Wrangler CLI and the Jobs REST API.

During indexing, content is parsed to Markdown (Workers AI), chunked, embedded, and optionally keyword-indexed for full-text search (How indexing works). Ingestion tokens are counted on final chunks after chunking, with overlap counted in each chunk (Limits & pricing).

Querying: Search endpoint, Chat Completions, and hybrid retrieval

Section titled “Querying: Search endpoint, Chat Completions, and hybrid retrieval”

Querying is synchronous. The pipeline may rewrite the query (optional), embed it, run vector and/or keyword retrieval, fuse hybrid results, rerank, return chunks, and optionally generate text (How querying works).

API Returns Use when
Search Relevant chunks You handle UI or bring your own LLM (Search REST API)
Chat Completions Retrieved context plus generated answer You want one call for grounded answers

Both use an OpenAI-compatible messages format. From Workers, call instance.search({ messages: [...] }) (Search Workers binding).

For filename-style matching rather than semantic Q&A, Cloudflare suggests disabling query rewriting and using smaller chunk sizes (for example 256 tokens) in Create a simple search engine.

Agents SDK tools map cleanly to the instance API:

The search_knowledge_base tool calls search() on the instance. Because the instance indexes both vectors and keywords, retrieval uses hybrid search by default.

— Cloudflare, Agents SDK

Each instance also exposes an MCP endpoint for agent clients (Connect MCP client, AI Search tool for agents).

Namespaces group instances (for example per tenant or environment). Create and list them with Wrangler:

wrangler ai-search namespace create docs-production --description "Production documentation search"
wrangler ai-search list --namespace docs-production

Details: Manage AI Search namespaces with Wrangler CLI. The Go/Python SDK exposes client.AISearch.Namespaces for the same operations (changelog SDK notes).

Workers bindings (release notes):

  • ai_search binding — bind to one instance (simple apps).
  • ai_search_namespaces binding — manage instances at runtime and use cross-instance search where supported.

Poll lifecycle with stats() on the instance handle (Instances Workers binding); pause or tune models with update() (reranking, rewrite_query, chunk_size, and more).

Included monthly usage (after billing starts): 5 million ingestion tokens, 10 GB-month storage, 1,000 semantic queries, 1,000 full-text queries (Limits & pricing). OCR and image processing draw from ingestion allotments; file size limits depend on format and OCR (see release note 2026-10-01).

Common mistakes

  • Creating a website instance for a domain not on the account (crawl is limited to sites you own).
  • Expecting instant search after items.upload() without polling—use uploadAndPoll, stats, or dashboard Playground only after indexing completes.
  • Relying on scheduled sync for time-sensitive publishes without jobs create (30-second minimum between triggers).
  • Re-uploading the same filename expecting versioning—Agents SDK notes that the same name overwrites and re-indexes (Agents SDK).
  • Leaving obsolete dedicated R2 buckets from older crawlers—after migration, AI Search may no longer write to them; you can delete unused buckets (Historical billing).

For public conversational search on a content site, Cloudflare offers NLWeb integration via the dashboard (public preview)—see NLWeb how-to.

  1. Confirm the instance exists and indexing finished: run wrangler ai-search stats <INSTANCE_NAME> or open the instance in the Cloudflare dashboard AI Search UI and review indexing status.

  2. Verify content is present: list items with the Items REST API or the instance Items tab described in Built-in storage.

  3. For website or R2 sources, check the latest sync: wrangler ai-search jobs list <INSTANCE_NAME> and, if needed, inspect logs with wrangler ai-search jobs logs (sync jobs changelog).

  4. Run an end-to-end query: wrangler ai-search search <INSTANCE_NAME> --query "..." or use the dashboard Playground (Wrangler get started).

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about so it can be corrected quickly.