---
title: Create AI Search endpoints and indexes
description: Create Databricks AI Search endpoints and indexes using the UI, Python SDK, or REST API, and configure an endpoint to serve the embedding model of your choice.
canonical_url: https://docs.databricks.com/aws/en/ai-search/create-ai-search
---

# Create AI Search endpoints and indexes

Use AI Search indexes for real-time similarity searches over a source table. AI Search endpoints serve these indexes for querying. Supported source types include Delta Lake tables, streaming tables, materialized views, or managed tables using [Iceberg v3](https://docs.databricks.com/aws/en/iceberg/iceberg-v3.md) or above. This page describes how to create both. For an introduction to AI Search, see [Databricks AI Search](https://docs.databricks.com/aws/en/ai-search/ai-search.md).

You can create and manage AI Search components, like an AI Search endpoint and AI Search indices, using the UI, the [Python SDK](https://api-docs.databricks.com/python/ai-search/databricks.ai_search.html), or the [REST API](https://docs.databricks.com/api/workspace/vectorsearchendpoints).

For example notebooks illustrating how to create and query AI Search endpoints, see [AI Search example notebooks](https://docs.databricks.com/aws/en/ai-search/example-notebooks.md). For reference information, see the [Python SDK reference](https://api-docs.databricks.com/python/ai-search/databricks.ai_search.html).

Databricks AI Search was formerly known as Databricks Vector Search. The REST API and several other tools use Vector Search in paths and identifiers, such as `/api/2.0/vector-search/endpoints`. See [API and tool names](https://docs.databricks.com/aws/en/ai-search/ai-search.md#vector-search-names).

## Requirements

* Unity Catalog enabled workspace.
* Serverless compute enabled. For instructions, see [Connect to serverless compute](https://docs.databricks.com/aws/en/compute/serverless/index.md).
* For [standard endpoints](https://docs.databricks.com/aws/en/ai-search/ai-search.md#endpoint-options), the source table must use a change data feed. See [Use change data feed on Databricks](https://docs.databricks.com/aws/en/tables/features/change-data-feed.md). Tables with [row tracking](https://docs.databricks.com/aws/en/tables/features/row-tracking.md) enabled use a change data feed automatically, without requiring manual configuration. This applies to Delta Lake tables, materialized views with external metadata enabled, and managed tables using Iceberg v3 or above.
* If the source is a materialized view, you must first enable external metadata (also called Smart Clone) on the materialized view or on the pipeline that defines it. See [How to enable access for a dataset](https://docs.databricks.com/aws/en/external-access/external-for-pipelines.md#enable).
* To create an AI Search index, you must have CREATE TABLE privileges on the catalog schema where you create the index.
* To query an index that is owned by another user, you must have additional privileges. See [How to query an AI Search index](https://docs.databricks.com/aws/en/ai-search/query-ai-search.md#query).

Permission to create and manage AI Search endpoints is configured using access control lists. See [AI Search endpoint ACLs](https://docs.databricks.com/aws/en/security/auth/access-control/index.md#vector-search-endpoints).

## Installation

To use the AI Search SDK, you must install it in your notebook. Use the following code to install the package:

```
%pip install databricks-ai-search
dbutils.library.restartPython()
```

Then use the following command to import `AISearchClient`:

```
from databricks.ai_search.client import AISearchClient
```

For information about authentication, see [Data protection and authentication](https://docs.databricks.com/aws/en/ai-search/ai-search.md#authentication).

## <a id="create-ai-search-endpoint" />Create an AI Search endpoint

You can create an AI Search endpoint using the Databricks UI, Python SDK, or the API.

### Create an AI Search endpoint using the UI

Follow these steps to create an AI Search endpoint using the UI.

1. In the left sidebar, click **Compute**.

2. Click the **AI Search** tab and click **Create endpoint**.

   ![Create AI Search compute.](https://docs.databricks.com/aws/en/images/generative-ai/create-endpoint.png)

3. The **Create endpoint form** opens. Enter a name for this endpoint.

   ![Create AI Search endpoint dialog.](https://docs.databricks.com/aws/en/images/generative-ai/vector-search-create-endpoint.png)

4. In the **Type** field, select **Standard** or **Storage Optimized**. See [ Endpoint options](https://docs.databricks.com/aws/en/ai-search/ai-search.md#endpoint-options).

5. (Optional) Under **Advanced settings**, select a usage policy. See [AI Search usage policies](https://docs.databricks.com/aws/en/ai-search/budget-policies.md).

6. Click **Confirm**.

### Create an AI Search endpoint using the Python SDK

The following example uses the [create\_endpoint()](https://api-docs.databricks.com/python/ai-search/databricks.ai_search.html#databricks.ai_search.client.AISearchClient.create_endpoint) SDK function to create an AI Search endpoint.

```python
# The following line automatically generates a PAT Token for authentication
client = AISearchClient()

# The following line uses the service principal token for authentication
# client = AISearchClient(service_principal_client_id=<CLIENT_ID>,service_principal_client_secret=<CLIENT_SECRET>)

client.create_endpoint(
    name="vector_search_endpoint_name",
    endpoint_type="STANDARD" # or "STORAGE_OPTIMIZED"
)
```

### Create an AI Search endpoint using the REST API

See the REST API reference documentation: [POST /api/2.0/vector-search/endpoints](https://docs.databricks.com/api/workspace/vectorsearchendpoints/createendpoint).

### <a id="create-endpoint-bundles" />Create an AI Search endpoint using Declarative Automation Bundles

You can define an AI Search endpoint as a resource in Declarative Automation Bundles to manage it as code alongside your jobs, pipelines, and other workspace assets. For an overview of bundles, see [What are Declarative Automation Bundles?](https://docs.databricks.com/aws/en/dev-tools/bundles/index.md).

> [!NOTE]
>
> Defining AI Search endpoints in a bundle is only supported with the [direct deployment engine](https://docs.databricks.com/aws/en/dev-tools/bundles/direct.md) and requires Databricks CLI version 1.1.0 or above.

The following example defines a standard AI Search endpoint:

```yaml
resources:
  vector_search_endpoints:
    my_vector_search_endpoint:
      name: my_vector_search_endpoint
      endpoint_type: STANDARD
```

For the full list of supported fields, including `endpoint_type`, `budget_policy_id`, `min_qps`, and `permissions`, see [vector\_search\_endpoint](https://docs.databricks.com/aws/en/dev-tools/bundles/resources.md#vector_search_endpoints).

### Create an endpoint with a target QPS for high-throughput workloads

For high-throughput workloads, you can create an endpoint with a target QPS. This feature is available for standard endpoints only.

To set a target QPS, use the `target_qps` parameter. See [ Scale endpoint throughput with high QPS](https://docs.databricks.com/aws/en/ai-search/best-practices.md#high-qps).

> [!IMPORTANT]
>
> Setting `target_qps` provisions additional capacity, which increases the cost of the endpoint. You are charged for this additional capacity regardless of actual query traffic. Throughput scaling is best-effort and not guaranteed.

```python
client.create_endpoint(
    name="vector_search_endpoint_name",
    endpoint_type="STANDARD",
    target_qps=500,  # target QPS for high-throughput workloads
)
```

To change the target QPS on an existing endpoint, use `update_endpoint()`.

```python
from databricks.ai_search.client import AISearchClient

client = AISearchClient()

# Set or update target QPS
response = client.update_endpoint(name="vector_search_endpoint_name", target_qps=500)

# Check scaling status
scaling_info = response.get("endpoint", {}).get("scaling_info", {})
print(f"State: {scaling_info.get('state')}")  # SCALING_CHANGE_IN_PROGRESS or SCALING_CHANGE_APPLIED
```

After updating target QPS, sync your indexes to apply the new configuration.

## (Optional) Create and configure an endpoint to serve the embedding model

If you choose to have Databricks compute the embeddings, you can use a pre-configured Foundation Model APIs endpoint or create a model serving endpoint to serve the embedding model of your choice. See [Pay-per-token Foundation Model APIs](https://docs.databricks.com/aws/en/machine-learning/foundation-model-apis/index.md#token-foundation-apis) or [Create foundation model serving endpoints](https://docs.databricks.com/aws/en/machine-learning/model-serving/create-foundation-model-endpoints.md) for instructions. For example notebooks, see [AI Search example notebooks](https://docs.databricks.com/aws/en/ai-search/example-notebooks.md).

When you configure an embedding endpoint, Databricks recommends that you remove the default selection of **Scale to zero**. Serving endpoints can take a couple of minutes to warm up, and the initial query on an index with a scaled down endpoint might timeout.

> [!NOTE]
>
> The AI Search index initialization might time out if the embedding endpoint isn't configured appropriately for the dataset. You should only use CPU endpoints for small datasets and tests. For larger datasets, use a GPU endpoint for optimal performance.

## <a id="create-vector-search-index" />Create an AI Search index

You can create an AI Search index using the UI, the Python SDK, or the REST API. The UI is the simplest approach.

There are two types of indexes:

* **Delta Sync Index** automatically syncs with a source table, incrementally updating the index as the underlying data in the source table changes. Supported source types include Delta Lake tables, streaming tables, materialized views, or managed tables using Iceberg v3 or above.
* **Direct Vector Access Index** supports direct read and write of vectors and metadata. You are responsible for updating this table using the REST API or the Python SDK. You can't create this type of index using the UI. You must use the REST API or the SDK.

Delta Sync Indexes support the following search modes:

* **Vector search** (ANN or hybrid): Requires embedding columns. Supports both standard and storage-optimized endpoints. You can also use `query_type="FULL_TEXT"` for keyword search on these indexes.
* **Dedicated full-text search index** (Beta): A Delta Sync Index created without any embedding columns, for keyword-only search. Available only on storage-optimized endpoints using triggered sync mode. See [Create a full-text search index](https://docs.databricks.com/aws/en/ai-search/create-ai-search.md#create-full-text-index).

### <a id="language-detection" />Automatic language detection

During sync, Databricks detects the dominant language for each text column and uses a language-specific analyzer. This applies to indexes on standard and storage-optimized endpoints. Supported languages are English, Chinese, Japanese, Korean, German, French, Spanish, Italian, Portuguese, and Russian.

> [!NOTE]
>
> The column name `_id` is reserved. If your source table has a column named `_id`, rename it before creating an AI Search index.

### <a id="create-ui" />Create index using the UI

1. In the left sidebar, click **Catalog** to open the Catalog Explorer UI.

2. Navigate to the source table you want to use.

3. Click the **Create** button at the upper-right, and select **Vector search index** from the drop-down menu.

   ![Create index button](https://docs.databricks.com/aws/en/images/generative-ai/create-index-button.png)

4. Use the selectors in the dialog to configure the index.

   ![create index dialog](https://docs.databricks.com/aws/en/images/generative-ai/create-index-form.png)

   #### Index structure

   **Name**: Name to use for the online table in Unity Catalog. The name requires a three-level namespace, `<catalog>.<schema>.<name>`. Names cannot contain spaces, periods, forward slashes, or control characters.

   **Index type**: Select **Hybrid** to support both semantic (vector) and keyword search on the same index. Select **Full-Text** for keyword-only search without embeddings. See [Create a full-text search index (Beta)](https://docs.databricks.com/aws/en/ai-search/create-ai-search.md#create-full-text-index) for full-text index requirements.

   **Primary key**: Column to use as a primary key.

   #### Embeddings

   **Embedding source**: Indicate if you want Databricks to compute embeddings for a text column in the source table (**Compute embeddings**), or if your source table contains precomputed embeddings (**Use existing embeddings**).

   * If you selected **Compute embeddings**, select the column that you want embeddings computed for. A Databricks-managed embedding model is selected by default. To use a different model, expand **Advanced settings** and choose from the **Embedding model** dropdown. Only text columns are supported.
     * For production applications using standard endpoints, Databricks recommends using the foundation model `databricks-qwen3-embedding-0-6b` with a provisioned throughput serving endpoint.

     * For production applications using storage-optimized endpoints with Databricks-hosted models, use the model name directly (for example, `databricks-qwen3-embedding-0-6b`) as the embedding model endpoint. Storage optimized endpoints use `ai_query` with batch inference at ingestion time, providing high throughput for the embedding job. If you prefer to use a provisioned throughput endpoint for querying, specify it in the `model_endpoint_name_for_query` field when you create the index.

   * If you selected **Use existing embeddings**, select the column that contains the precomputed embeddings and the embedding dimension. The format of the precomputed embedding column should be `array[float]`. For storage-optimized endpoints, the embedding dimension must be evenly divisible by 16.

   **Save computed embeddings**: Toggle this setting to save the generated embeddings to a Unity Catalog table. For more information, see [Save generated embedding table](https://docs.databricks.com/aws/en/ai-search/create-ai-search.md#sync-embeddings-table).

   #### Compute resources

   **Vector Search endpoint**: Select the vector search endpoint to store the index.

   **Sync mode**: **Continuous** keeps the index in sync with seconds of latency. However, it has a higher cost associated with it since a compute cluster is provisioned to run the continuous sync streaming pipeline.

   * For standard endpoints, both **Continuous** and **Triggered** perform incremental updates, so only data that has changed since the last sync is processed.
   * For storage-optimized endpoints, every sync partially rebuilds the index. For managed indexes on subsequent syncs, any generated embeddings where the source row has not changed are reused and do not need to be recomputed. See [Storage-optimized endpoints limitations](https://docs.databricks.com/aws/en/ai-search/ai-search.md#so-endpoints-limitations).

   With **Triggered** sync mode, you use the Python SDK or the REST API to start the sync. See [Update a Delta Sync Index](https://docs.databricks.com/aws/en/ai-search/create-ai-search.md#update-delta-sync).

   For storage-optimized endpoints, only **Triggered** sync mode is supported.

   #### Advanced settings

   ![Advanced settings](https://docs.databricks.com/aws/en/images/generative-ai/vector-search-advanced-settings.png)

   The **Advanced settings** section is collapsed by default. Most users can accept the defaults. Expand it to fine-tune any of the following:

   **Embedding model**: Override the default embedding model. The default Databricks-hosted model works for most workspaces. Change it here if you need a different one or if you don't have access to the default.

   **Columns to index**: Select the columns to include in the index. If you leave this field blank, all columns from the source table are indexed. The primary key and embedding columns are always included. Only indexed columns can be returned in search results or used as filters.

   **Usage policy**: Apply a usage policy to tag the index's costs for tracking by team or project. See [AI Search usage policies](https://docs.databricks.com/aws/en/ai-search/budget-policies.md).

   **Use a separate embedding model for queries**: If you selected **Compute embeddings**, select this option to specify a separate embedding model serving endpoint for querying the index. This can be useful if you need a high-throughput endpoint for ingestion but a lower-latency endpoint for querying. The model specified in the **Embedding model** field is always used for ingestion and is also used for querying unless you specify a different model here.

5. When you have finished configuring the index, click **Create**.

### Create index using the Python SDK

The following example creates a Delta Sync Index with embeddings computed by Databricks. For details, see the [Python SDK reference](https://api-docs.databricks.com/python/ai-search/databricks.ai_search.html).

This example also uses the optional `model_endpoint_name_for_query` parameter, which routes queries to a different serving endpoint running the same embedding model. That lets you pair a high-throughput endpoint for ingestion with a low-latency endpoint for queries.

```python
client = AISearchClient()

index = client.create_delta_sync_index(
  endpoint_name="vector_search_demo_endpoint",
  source_table_name="vector_search_demo.vector_search.en_wiki",
  index_name="vector_search_demo.vector_search.en_wiki_index",
  pipeline_type="TRIGGERED",
  primary_key="id",
  embedding_source_column="text",
  embedding_model_endpoint_name="databricks-qwen3-embedding-0-6b", # Used for ingestion, and also for querying unless model_endpoint_name_for_query is specified.
  model_endpoint_name_for_query="qwen3-embedding-low-latency"      # Optional. A separate endpoint serving the same model, used only for querying.
)
```

The following example creates a Delta Sync Index with self-managed embeddings.

```python
client = AISearchClient()

index = client.create_delta_sync_index(
  endpoint_name="vector_search_demo_endpoint",
  source_table_name="vector_search_demo.vector_search.en_wiki",
  index_name="vector_search_demo.vector_search.en_wiki_index",
  pipeline_type="TRIGGERED",
  primary_key="id",
  embedding_dimension=1024,
  embedding_vector_column="text_vector"
)
```

By default, all columns from the source table are synced with the index. To select a subset of columns to sync, use `columns_to_sync`. The primary key and embedding columns are always included in the index.

To sync *only* the primary key and the embedding column, you must specify them in `columns_to_sync` as shown:

```python
index = client.create_delta_sync_index(
  ...
  columns_to_sync=["id", "text_vector"] # to sync only the primary key and the embedding column
)
```

To sync additional columns, specify them as shown. You do not need to include the primary key and the embedding column, as they are always synced.

```python
index = client.create_delta_sync_index(
  ...
  columns_to_sync=["revisionId", "text"] # to sync the `revisionId` and `text` columns in addition to the primary key and embedding column.
)
```

### <a id="create-full-text-index" />Create a full-text search index (Beta)

> [!NOTE]
> **Beta**
>
> Full-text search index creation is available as part of the **AI Search: Full-Text Search** beta on storage-optimized endpoints only. To use it, enable **AI Search: Full-Text Search** in **Previews**. Contact your account team or see [Manage Databricks previews](https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews.md) to enable previews.

A full-text search index enables keyword-based search on text columns without requiring vector embeddings. This is useful when you want to search for exact terms, identifiers, or keywords rather than semantic similarity.

Full-text search indexes have the following requirements:

* Must use a **storage-optimized** endpoint. Standard endpoints are not supported.
* Must use **Triggered** sync mode. Continuous sync is not supported.
* The parameters `embedding_source_column`, `embedding_vector_column`, and `embedding_dimension` are not supported.

The following example creates a full-text search index using the Python SDK.

```python
client = AISearchClient()

index = client.create_delta_sync_index(
  endpoint_name="storage_optimized_endpoint",
  source_table_name="catalog.schema.source_table",
  index_name="catalog.schema.full_text_index",
  pipeline_type="TRIGGERED",
  primary_key="id",
  columns_to_sync=["id", "text", "metadata_column"],
  index_subtype="FULL_TEXT"
)
```

After creating the index, trigger a sync to populate it:

```python
index.sync()
```

To query the full-text index, use `query_type="FULL_TEXT"`. See [Query an AI Search index](https://docs.databricks.com/aws/en/ai-search/query-ai-search.md) for details.

```python
results = index.similarity_search(
  query_text="search terms",
  columns=["id", "text"],
  num_results=10,
  query_type="FULL_TEXT"
)
```

The following example creates a Direct Vector Access Index.

```python

client = AISearchClient()

index = client.create_direct_access_index(
  endpoint_name="storage_endpoint",
  index_name=f"{catalog_name}.{schema_name}.{index_name}",
  primary_key="id",
  embedding_dimension=1024,
  embedding_vector_column="text_vector",
  schema={
    "id": "int",
    "field2": "string",
    "field3": "float",
    "text_vector": "array<float>"}
)
```

### Create index using the REST API

See the REST API reference documentation: [POST /api/2.0/vector-search/indexes](https://docs.databricks.com/api/workspace/vectorsearchindexes/createindex).

### <a id="sync-embeddings-table" />Save generated embedding table

If Databricks generates the embeddings, you can save the generated embeddings to a table in Unity Catalog. This table is created in the same schema as the vector index and is linked from the vector index page.

The name of the table is the name of the AI Search index, appended by `_writeback_table`. The name is not editable.

You can access and query the table like any other table in Unity Catalog. However, you should not drop or modify the table, as it is not intended to be manually updated. The table is deleted automatically if the index is deleted.

## Update an AI Search index

### <a id="update-delta-sync" />Update a Delta Sync Index

Indexes created with **Continuous** sync mode automatically update when the source table or view changes. If you are using **Triggered** sync mode, you can start the sync using the UI, the Python SDK, or the REST API.

#### Databricks UI

1. In Catalog Explorer, navigate to the AI Search index.
2. On the **Overview** tab, in the **Data Ingest** section, click **Sync now**.

   ![Sync now button to sync an AI Search index from Catalog Explorer.](https://docs.databricks.com/aws/en/images/generative-ai/sync-now.png).

#### Python SDK

For details, see the [Python SDK reference](https://api-docs.databricks.com/python/ai-search/databricks.ai_search.html).

```python
client = AISearchClient()
index = client.get_index(index_name="vector_search_demo.vector_search.en_wiki_index")

index.sync()
```

#### REST API

See the REST API reference documentation: [POST /api/2.0/vector-search/indexes/\{index\_name}/sync](https://docs.databricks.com/api/workspace/vectorsearchindexes/syncindex).

### Update a Direct Vector Access Index

You can use the Python SDK or the REST API to insert, update, or delete data from a Direct Vector Access Index.

#### Python SDK

For details, see the [Python SDK reference](https://api-docs.databricks.com/python/ai-search/databricks.ai_search.html).

```python
index.upsert([
    {
        "id": 1,
        "field2": "value2",
        "field3": 3.0,
        "text_vector": [1.0] * 1024
    },
    {
        "id": 2,
        "field2": "value2",
        "field3": 3.0,
        "text_vector": [1.1] * 1024
    }
])
```

#### REST API

See the REST API reference documentation: [POST /api/2.0/vector-search/indexes](https://docs.databricks.com/api/workspace/vectorsearchindexes).

For production applications, Databricks recommends using service principals instead of personal access tokens. Performance can be improved by up to 100 msec per query.

The following code example illustrates how to update an index using a service principal.

```sh
export SP_CLIENT_ID=...
export SP_CLIENT_SECRET=...
export INDEX_NAME=...
export WORKSPACE_URL=https://...
export WORKSPACE_ID=...

# Set authorization details to generate OAuth token
export AUTHORIZATION_DETAILS='{"type":"unity_catalog_permission","securable_type":"table","securable_object_name":"'"$INDEX_NAME"'","operation": "WriteVectorIndex"}'

# Generate OAuth token
export TOKEN=$(curl -X POST --url $WORKSPACE_URL/oidc/v1/token -u "$SP_CLIENT_ID:$SP_CLIENT_SECRET" --data 'grant_type=client_credentials' --data 'scope=all-apis' --data-urlencode 'authorization_details=['"$AUTHORIZATION_DETAILS"']' | jq .access_token | tr -d '"')

# Get index URL
export INDEX_URL=$(curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" --url $WORKSPACE_URL/api/2.0/vector-search/indexes/$INDEX_NAME | jq -r '.status.index_url' | tr -d '"')

# Upsert data into AI Search index.
curl -X POST -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" --url https://$INDEX_URL/upsert-data --data '{"inputs_json": "[...]"}'

# Delete data from AI Search index
curl -X DELETE -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" --url https://$INDEX_URL/delete-data --data '{"primary_keys": [...]}'
```

The following code example illustrates how to update an index using a personal access token (PAT).

```sh
export TOKEN=...
export INDEX_NAME=...
export WORKSPACE_URL=https://...

# Upsert data into AI Search index.
curl -X POST -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" --url $WORKSPACE_URL/api/2.0/vector-search/indexes/$INDEX_NAME/upsert-data --data '{"inputs_json": "..."}'

# Delete data from AI Search index
curl -X DELETE -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" --url $WORKSPACE_URL/api/2.0/vector-search/indexes/$INDEX_NAME/delete-data --data '{"primary_keys": [...]}'
```

### How to make schema changes with no downtime

Schema changes to the source table are not supported unless you rebuild the index. This includes modifying existing columns and adding new columns. The index schema is fixed at creation time, so any schema changes require creating a new index to take effect.

Follow these steps to rebuild and deploy the index with no downtime:

1. Perform the schema change on your source table.
2. Create a new index using the updated schema.
3. After the new index is ready, switch traffic to the new index.
4. Delete the original index.
