> ## Documentation Index
> Fetch the complete documentation index at: https://docs.asktable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Search (Value Index)

> AI Search (Value Index) is an optional component in a private deployment. Backed by the aisearch engine, it indexes field values so questions asked with abbreviations still match the full values stored in your database. This page shows how to enable it in Compose.

AskTable's **AI Search (Value Index)** is an **optional component** in a private deployment. It powers the [AI Index](/en/concepts/data/ai-search) capability: it indexes the **distinct values** of string fields, so when users ask with an abbreviation or colloquial term ("Alibaba", "Mate 40"), the system matches them to the full values actually stored in your database and generates the correct query conditions.

Under the hood it runs on the **aisearch** engine. **Without aisearch deployed, the feature is entirely unavailable** — enabling "AI Index" for a field in the console reports it as not enabled, and questions won't do value matching (other features are unaffected).

## Enable it in Compose

Two steps: add an aisearch service, then tell `asktable` its address and key.

### 1. Add the aisearch service

Add this service to the `docker-compose.yaml` from [Private Deployment](/en/deploy/docker):

```yaml theme={null}
services:
  # aisearch engine (optional): stores and serves the value index
  asktable-aisearch:
    image: registry.cn-shanghai.aliyuncs.com/dminfra/aisearch:v1.12.8
    container_name: asktable-aisearch
    restart: unless-stopped
    environment:
      MEILI_MASTER_KEY: asktable-aisearch-master-key   # [change me] at least 16 bytes
      MEILI_ENV: production                            # production mode: enforces auth, disables the search preview page
      MEILI_NO_ANALYTICS: "true"                       # disable telemetry
    volumes:
      - ./aisearch_data:/meili_data                    # persist index data (engine data directory)
```

It is only reached by `asktable` over the internal Compose network, so **you don't need to expose a port**.

### 2. Point asktable at it

Add two variables to the `asktable` service's `environment`, and add it to `depends_on`:

```yaml theme={null}
services:
  asktable:
    depends_on:
      - asktable-aisearch          # add this line
    environment:
      AISEARCH_HOST: http://asktable-aisearch:7700
      AISEARCH_MASTER_KEY: asktable-aisearch-master-key   # must exactly match MEILI_MASTER_KEY above
```

<Warning>
  `AISEARCH_MASTER_KEY` must match aisearch's `MEILI_MASTER_KEY` above **exactly**, or `asktable` cannot connect and the feature stays unavailable. In production, replace the sample key with your own random string (with `MEILI_ENV: production`, the key must be at least 16 bytes, otherwise aisearch refuses to start).
</Warning>

Run `docker compose up -d` to apply.

## Building and rebuilding the index

Once both variables are set, AI Search is truly enabled. Indexes are built asynchronously by a background task running on the existing `asktable-redis` queue — no extra component required:

* **Per-field toggle**: on the data source's **Data Overview** tab, select a table and enable fields one by one in the "AI Index" column — see [AI Index](/en/concepts/data/ai-search) for usage and statistics.
* **Whole-source build / rebuild**: to rebuild all value indexes for a data source at once, click "Build Value Index" on the data source page.

<Note>
  By default only **short string fields** are indexed (not long text, dates, or numbers). The number of fields per data source that can have a value index is capped (10 by default) and adjustable in the admin console; the number of distinct values kept per field is also capped. These limits keep excessive indexes from slowing the system down or adding noise.
</Note>

aisearch is self-contained and makes no outbound calls at runtime, so it is suitable for fully offline / air-gapped deployments.

## Next steps

* [AI Index](/en/concepts/data/ai-search) — how the feature works and which fields to pick
* [Private Deployment (Docker)](/en/deploy/docker) — deploy AskTable itself
