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

# AI Search

> Enable intelligent semantic search across your data using AI embeddings

AI Search lets you find information by meaning and context rather than exact keyword matches. It uses embeddings to convert text into vector representations and then compares semantic similarity, so a search for "delivery delays" can surface records about "shipping bottleneck" even when no words overlap. You can configure multiple search fields per table and choose between semantic search and keyword search for each field.

AI Search is available on **Elements** and **Tables**. You can also use it as an action step in automations or as a tool that agents can call at runtime.

## Requirements

<Warning>
  **Snowflake Cortex only.** AI Search is exclusively powered by Snowflake Cortex embedding services. OpenAI and Gemini providers cannot be used for AI Search.
</Warning>

Before configuring AI Search, confirm the following:

* **Snowflake Cortex provider** configured with an embedding service — see [Snowflake Cortex Setup](/ai-agents/snowflake-cortex-setup)
* **Standard Snowflake table** — transient, temporary, hybrid, external, and dynamic tables are not supported
* **Change tracking enabled** on all underlying Snowflake tables — this can be enabled at any time, even after connecting an Element to Elementum. Run `ALTER TABLE <table_name> SET CHANGE_TRACKING = TRUE;` if it is not already on.
* **At least one text field** containing the content you want to search
* **A unique identifier field** (primary key) on each record

<Info>
  For automation triggers like "Record is updated" on Snowflake tables, change tracking must be enabled **before** configuring the trigger.
</Info>

## How It Works

1. **Content processing** — Your text data is converted into high-dimensional vectors (embeddings) that represent semantic meaning.
2. **Query understanding** — When you search, your query is converted into an embedding using the same model.
3. **Similarity matching** — The system finds content whose embeddings are closest to your query, regardless of exact word overlap.
4. **Results ranking** — Results are ordered by semantic similarity so the most relevant records appear first.

## Setting Up AI Search

There are two ways to set up AI Search: create a new search table from scratch, or link an existing Cortex Search service that already lives in Snowflake.

### Create a New Search Table

<Steps>
  <Step title="Navigate to AI Search">
    In the Intelligence tab, select **AI Search** from the menu.
  </Step>

  <Step title="Add a search table">
    Click **+ Search Table** to begin configuring a new searchable table.
  </Step>

  <Step title="Select your table and fields">
    * **Standard Table** — Select a Standard Snowflake table
    * **Unique Identifier** — Specify the field that uniquely identifies each record
    * **Fields to Search** — Add one or more text fields to search. For each field, choose a search type:
      * **Semantic search** — Finds results by meaning and context using embeddings, even when wording differs from the query
      * **Keyword search** — Matches results based on exact terms in the query
  </Step>

  <Step title="Configure search parameters">
    * **Attribute Fields** — Select additional fields to return alongside search results (e.g., category, status, date)
    * **Service** — Choose your configured Snowflake Cortex embedding service
    * **Archival Service** — Select the Snowflake Cortex service to use when running search queries
    * **Target Lag** — Set how frequently the search index updates (`1` = daily)
  </Step>

  <Step title="Create the search configuration">
    Click **Create** to build the search index. Initial indexing may take time depending on data volume.
  </Step>
</Steps>

After clicking **Create**, track the configuration status on the AI Search page. The table displays a status indicator that moves from **Loading** to **Ready** once the search index is fully built and available for queries. If an error occurs during creation, click **Retry** to reattempt the search table setup.

### Link an Existing Cortex Search Service

If you already have a Cortex Search service running in Snowflake, you can link it directly to an App or Element without recreating it in Elementum. The linked service becomes available for AI Search queries immediately.

<Steps>
  <Step title="Navigate to AI Search">
    Open the App or Element where you want to use the existing search service. In the Intelligence tab, select **AI Search** from the menu.
  </Step>

  <Step title="Choose to link an existing service">
    Click **+ Search Table** and select the option to link an existing Cortex Search service.
  </Step>

  <Step title="Configure the connection details">
    Provide the following information to locate the service in Snowflake:

    * **Provider** — Select the Snowflake Cortex provider configured in your organization
    * **Database** — Choose the Snowflake database where the service resides
    * **Schema** — Select the schema that contains the Cortex Search service
    * **Search Table Name** — Enter the name of the existing Cortex Search service
  </Step>

  <Step title="Link the service">
    Click **Create** to link the service. Once linked, the search table is available for AI Search queries on the App or Element.
  </Step>
</Steps>

<Info>
  Removing a linked Cortex Search service from Elementum only removes the reference — it does not delete the underlying service in Snowflake. Your Cortex Search service continues to run independently in your Snowflake environment.
</Info>

## Using the Search Interface

Once a search table is configured, you can query it directly from the AI Search interface.

**Natural language queries** — Type questions in plain language. AI Search understands meaning, so queries like "issues with payment processing" or "customer complaints about delivery" return semantically relevant results even when records use different phrasing.

**Filtering** — Combine semantic search with attribute filters to narrow results by field values, date ranges, or categories.

**Results** — Each result includes the matched text, a similarity score indicating how closely it relates to your query, and any attribute fields you configured during setup.

## AI Search in Other Features

AI Search integrates with automations, agents, and Tables. Rather than configuring AI Search differently in each context, you set it up once (as described above) and then reference the search table where needed.

### Automations

Use the **AI Search** action in an automation to run a semantic query as part of a workflow. Select a configured AI Search table as the source and pass a dynamic query using value references from earlier in the automation (e.g., `{{trigger.description}}`).

For full configuration details and output variables, see [AI Data Search](/workflows/automation-actions-reference#ai-data-search) in the Automation Actions Reference. For broader guidance on using AI within automations, see [AI in Automations](/ai-agents/ai-automations).

### Agents

AI Search can be configured as a tool that agents call at runtime to look up relevant records during a conversation. When adding AI Search as an agent tool, you can define input value references with descriptions and use them in filters so the agent passes values dynamically for context-aware search.

For details on configuring agent tools, see [Agent Skills](/ai-agents/agents-skills). For building and managing agents, see [Building Agents](/ai-agents/agents-experience).

### Tables

Table admins can enable AI Search on any Table. The setup follows the same process described above. For details on enabling AI Search within the Tables interface, see the [AI Search section](/data/tables#ai-search) on the Tables page.

## Tips for Better Results

* **Choose descriptive text fields.** The fields you index should contain meaningful, readable content — not codes or IDs. Fields with complete sentences or descriptions produce better semantic matches.
* **Keep content at a reasonable length.** Embedding models work best with content in the 512–1,024 token range. Very short or very long text can reduce match quality.
* **Use consistent language.** Consistent terminology and formatting across records improves how well the embedding model captures your domain's semantics.
* **Set appropriate result limits.** For most use cases, 10–50 results strikes the right balance between coverage and relevance. In automation workflows, start with a smaller limit and increase if needed.
* **Update your index regularly.** The Target Lag setting controls how often new or changed records are indexed. Daily updates (Target Lag = `1`) work well for most cases; adjust if your data changes more frequently.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Change tracking errors">
    **Symptoms:** AI Search fails to create or index properly, or you receive errors about change tracking.

    **Solutions:**

    1. Enable change tracking on the source Snowflake table:
       ```sql theme={null}
       ALTER TABLE <table_name> SET CHANGE_TRACKING = TRUE;
       ```
    2. Verify change tracking is active:
       ```sql theme={null}
       SHOW TABLES LIKE '<table_name>';
       ```
       Check the `change_tracking` column in the output.
    3. For "Record is updated" automation triggers, change tracking must be enabled before configuring the trigger.
  </Accordion>

  <Accordion title="Cannot configure AI Search on a table">
    **Symptoms:** The setup dialog does not allow you to create a search configuration.

    **Solutions:**

    1. Confirm the table is a **Standard Snowflake table**. Transient, temporary, hybrid, external, and dynamic tables are not supported.
    2. Verify that a Snowflake Cortex **embedding service** is configured under [AI Services](/ai-agents/ai-services).
    3. Check that change tracking is enabled on the underlying table.
    4. Ensure you have the necessary permissions to configure search.
  </Accordion>

  <Accordion title="Poor or irrelevant search results">
    **Symptoms:** Searches return results that don't match the intent of your query.

    **Solutions:**

    1. Review the content in your indexed text fields — short, vague, or code-like values produce weaker embeddings.
    2. Try rephrasing your query to be more specific.
    3. Check that the correct embedding service is selected in the search configuration.
    4. If the indexed content has changed significantly since the last index update, wait for the next index refresh or reduce the Target Lag setting.
  </Accordion>

  <Accordion title="Slow search responses">
    **Symptoms:** Search queries take longer than expected to return results.

    **Solutions:**

    1. Reduce the number of attribute fields returned with results.
    2. Lower the result limit if it is set high.
    3. Ensure your Snowflake warehouse is appropriately sized for the data volume.
    4. Check Snowflake Cortex service status for any provider-side latency.
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="AI Services" icon="sliders" href="/ai-agents/ai-services">
    Create and manage the embedding services that power AI Search
  </Card>

  <Card title="AI in Automations" icon="wand-sparkles" href="/ai-agents/ai-automations">
    Learn how AI actions — including AI Search — fit into automation workflows
  </Card>

  <Card title="Building Agents" icon="robot" href="/ai-agents/agents-experience">
    Create agents that use AI Search as a runtime tool
  </Card>

  <Card title="Automation Actions Reference" icon="book" href="/workflows/automation-actions-reference">
    Full configuration details for the AI Search automation action
  </Card>
</CardGroup>
