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

# Vector Search

export const ComponentMetadata = ({warehouses, unsupportedWarehouses = [], componentType, connectionInputs, connectionOutputs}) => {
  const allWarehouses = [...warehouses.map(w => ({
    name: w,
    supported: true
  })), ...unsupportedWarehouses.map(w => ({
    name: w,
    supported: false
  }))];
  return <div style={{
    background: 'var(--colors-background-light, #f9fafb)',
    border: '1px solid var(--colors-border-default, #e5e7eb)',
    borderRadius: '12px',
    padding: '20px 28px',
    marginBottom: '28px',
    boxShadow: '0 1px 4px rgba(0,0,0,0.10)'
  }}>
      <table style={{
    width: '100%',
    borderCollapse: 'collapse'
  }}>
        <tbody>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle',
    width: '180px'
  }}>Project Availability</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>
              <div style={{
    display: 'flex',
    flexWrap: 'wrap',
    gap: '8px'
  }}>
                {allWarehouses.map((w, i) => <span key={i} style={{
    background: w.supported ? '#dcfce7' : '#fee2e2',
    color: w.supported ? '#15803d' : '#b91c1c',
    border: `1px solid ${w.supported ? '#bbf7d0' : '#fca5a5'}`,
    borderRadius: '9999px',
    padding: '3px 12px',
    fontSize: '0.85rem',
    fontWeight: '500',
    whiteSpace: 'nowrap'
  }}>
                    {w.name} {w.supported ? '✅' : '❌'}
                  </span>)}
              </div>
            </td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Component Type</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>{componentType}</td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    paddingBottom: '14px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Connection Inputs</td>
            <td style={{
    paddingBottom: '14px',
    verticalAlign: 'middle'
  }}>{connectionInputs}</td>
          </tr>
          <tr>
            <td style={{
    fontWeight: '600',
    paddingRight: '32px',
    whiteSpace: 'nowrap',
    verticalAlign: 'middle'
  }}>Connection Outputs</td>
            <td style={{
    verticalAlign: 'middle'
  }}>{connectionOutputs}</td>
          </tr>
        </tbody>
      </table>
    </div>;
};

<Info>
  Production use of this feature is available for specific editions only. [Contact our sales team](https://www.matillion.com/contact) for more information.
</Info>

<ComponentMetadata warehouses={["Snowflake"]} unsupportedWarehouses={["Databricks", "Amazon Redshift", "BigQuery"]} componentType="Transformation" connectionInputs="Two" connectionOutputs="Unlimited" />

The **Vector Search** transformation component performs a search on an input table to find content that best answers specific questions, using vector embeddings to identify suitable answers within the input data.

The component requires two input tables: an **Index Table** that contains the data you are querying, and a **Query Table** that contains the questions you are asking, one question per table row. From each table, there should be at least one column (which contains an embedding) that will be used to perform the similarity search. The data in these tables must be in the form of Cortex vector embeddings. You can convert English-language text into Cortex embeddings using the [Cortex Embed](/docs/components/cortex-embed) component, and use the output from that component as an input into Vector Search.

The component outputs the best-fit answers to each query input, with as many answers per query as asked for in the **Top K** property. The answer is output as plain-language text, and can be in the form of a multi-column table or a column of JSON objects.

To learn more about Cortex vector embeddings, read [Vector Embeddings](https://docs.snowflake.com/en/user-guide/snowflake-cortex/vector-embeddings).

### Use case

Typical use cases for a vector search include the following:

* Performing a semantic text search to return the most contextually relevant documents, even if they don't share exact keywords.
* Personalizing content retrieval by matching users to relevant content based on their interests or behavior embeddings.
* Powering support systems by finding the closest pre-written response or FAQ entry for a customer's question.

***

## Properties

<ResponseField name="Name" type="string" required>
  A human-readable name for the component.
</ResponseField>

{/* <!-- param-start:[indexTable] | warehouses: [snowflake] --> */}

<ResponseField name="Index Table" type="drop-down" required>
  The table that contains the data to be searched.
</ResponseField>

{/* <!-- param-start:[queryTable] | warehouses: [snowflake] --> */}

<ResponseField name="Query Table" type="drop-down" required>
  The table that contains the questions you want to have answered.
</ResponseField>

{/* <!-- param-start:[similarityFunction] | warehouses: [snowflake] --> */}

<ResponseField name="Similarity Function" type="drop-down" required>
  The measurement of similarity between vectors is performed by a Snowflake Cortex vector similarity function. Choose which of the three supported functions the search will use:

  * Cosine Similarity
  * L2 Distance
  * Inner Product

  For descriptions of these functions, read [About vector similarity functions](https://docs.snowflake.com/en/user-guide/snowflake-cortex/vector-embeddings#about-vector-similarity-functions).
</ResponseField>

{/* <!-- param-start:[outputMode] | warehouses: [snowflake] --> */}

<ResponseField name="Output Mode" type="drop-down" required>
  You can choose to output the results of the search as table **Columns** or **JSON** objects.
</ResponseField>

{/* <!-- param-start:[indexTableEmbeddingColumn] | warehouses: [snowflake] --> */}

<ResponseField name="Index Table Embedding Column" type="drop-down" required>
  Select the column of the **Index Table** that contains the embeddings you want to query. The component operates on a single input column only. If you have multiple embedding columns in the table, you'll need to perform additional transformations on your data to reduce them to a single column before querying.

  Additional non-embedding columns (i.e. not only the column selected here) will also be retrieved from the index table and displayed in the output.
</ResponseField>

{/* <!-- param-start:[queryTableEmbeddingColumn] | warehouses: [snowflake] --> */}

<ResponseField name="Query Table Embedding Column" type="drop-down" required>
  Select the column of the **Query Table** that contains the question embeddings. The component operates on a single input column only. If you have multiple embedding columns in the table, you'll need to perform additional transformations on your data to reduce them to a single column before querying.

  Additional non-embedding columns (i.e. not only the column selected here) will also be retrieved from the query table and displayed in the output.
</ResponseField>

{/* <!-- param-start:[queryTableKeyColumn] | warehouses: [snowflake] --> */}

<ResponseField name="Query Table Key Column" type="drop-down" required>
  Select the column that functions as the query table's primary key.
</ResponseField>

{/* <!-- param-start:[topK] | warehouses: [snowflake] --> */}

<ResponseField name="Top K" type="string" required>
  The number of results to return from the vector database query. Between 1-100. The default is 5, which will return the top five best-fitting answers to the query.
</ResponseField>
