Wrangler commands
List all AI Search instances
npx wrangler ai-search listpnpm wrangler ai-search listyarn wrangler ai-search list-
--jsonbooleandefault: falseReturn output as clean JSON
-
--pagenumberdefault: 1Page number of the results, can configure page size using "per-page"
-
--per-pagenumberNumber of instances to show per page
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Create a new AI Search instance
npx wrangler ai-search create [NAME]pnpm wrangler ai-search create [NAME]yarn wrangler ai-search create [NAME]-
[NAME]stringrequiredThe name of the AI Search instance to create (must be unique).
-
--sourcestringData source identifier (R2 bucket name or web URL).
-
--typestringThe source type for the instance.
-
--embedding-modelstringEmbedding model to use.
-
--generation-modelstringLLM model for chat completions.
-
--chunk-sizenumberChunk size for document splitting (min: 64).
-
--chunk-overlapnumberOverlap between document chunks.
-
--max-num-resultsnumberMaximum search results per query.
-
--rerankingbooleanEnable reranking of search results.
-
--reranking-modelstringModel to use for reranking.
-
--hybrid-searchbooleanEnable hybrid (keyword + vector) search.
-
--cachebooleanEnable response caching.
-
--score-thresholdnumberMinimum relevance score threshold (0-1).
-
--prefixstringR2 key prefix to scope indexing.
-
--include-itemsarrayGlob patterns for items to include.
-
--exclude-itemsarrayGlob patterns for items to exclude.
-
--jsonbooleandefault: falseReturn output as clean JSON
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Get details of an AI Search instance
npx wrangler ai-search get [NAME]pnpm wrangler ai-search get [NAME]yarn wrangler ai-search get [NAME]-
[NAME]stringrequiredThe name of the AI Search instance.
-
--jsonbooleandefault: falseReturn output as clean JSON
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Update an AI Search instance configuration
npx wrangler ai-search update [NAME]pnpm wrangler ai-search update [NAME]yarn wrangler ai-search update [NAME]-
[NAME]stringrequiredThe name of the AI Search instance to update.
-
--embedding-modelstringUpdate the embedding model.
-
--generation-modelstringUpdate the LLM model for chat completions.
-
--chunk-sizenumberUpdate the chunk size.
-
--chunk-overlapnumberUpdate the chunk overlap.
-
--max-num-resultsnumberUpdate max search results per query.
-
--rerankingbooleanEnable or disable reranking.
-
--reranking-modelstringUpdate the reranking model.
-
--hybrid-searchbooleanEnable or disable hybrid search.
-
--cachebooleanEnable or disable caching.
-
--score-thresholdnumberUpdate the minimum relevance score threshold (0-1).
-
--pausedbooleanPause or resume the instance.
-
--jsonbooleandefault: falseReturn output as clean JSON
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Delete an AI Search instance
npx wrangler ai-search delete [NAME]pnpm wrangler ai-search delete [NAME]yarn wrangler ai-search delete [NAME]-
[NAME]stringrequiredThe name of the AI Search instance to delete.
-
--forcebooleanalias: --y default: falseSkip confirmation
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Get usage statistics for an AI Search instance
npx wrangler ai-search stats [NAME]pnpm wrangler ai-search stats [NAME]yarn wrangler ai-search stats [NAME]-
[NAME]stringrequiredThe name of the AI Search instance.
-
--jsonbooleandefault: falseReturn output as clean JSON
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources
Execute a semantic search query against an AI Search instance
npx wrangler ai-search search [NAME]pnpm wrangler ai-search search [NAME]yarn wrangler ai-search search [NAME]-
[NAME]stringrequiredThe name of the AI Search instance.
-
--querystringrequiredThe search query text.
-
--max-num-resultsnumberOverride maximum number of results.
-
--score-thresholdnumberOverride minimum relevance score (0-1).
-
--rerankingbooleanOverride reranking setting.
-
--filterarrayMetadata filter as key=value (repeatable, e.g. --filter type=docs --filter lang=en).
-
--jsonbooleandefault: falseReturn output as clean JSON
Global flags
-
--vbooleanalias: --versionShow version number
-
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
-
--configstringalias: --cPath to Wrangler configuration file
-
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
-
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
-
--experimental-provisionbooleanaliases: --x-provision default: trueExperimental: Enable automatic resource provisioning
-
--experimental-auto-createbooleanalias: --x-auto-create default: trueAutomatically provision draft bindings with new resources