Quick start: Text vector search

更新时间:
复制 MD 格式

Purchase an instance

To purchase an instance, see Purchase an OpenSearch Vector Search Edition instance.

Configure the cluster

On the instance list page, the status of a newly purchased instance is Pending Configuration. In the Actions column, click Configure to go to the instance details page. Configure the cluster by completing the following steps: Basic Table Information > Data Synchronization > Field Configuration > Index Schema > Confirm Creation. After the index is rebuilt, you can start searching.

1. Basic table information

Navigate to Table ManagementAdd Table to open the Basic Table Information page. Enter a Table name, set the number of data shards and data update resources. For Scenario template, select Vector: Text Semantic Search-Dense Vector Retrieval. After you confirm the settings, click Next.

Notes on configuration:

  • Table name: You can specify a custom name.

  • Data shards: Enter a positive integer up to 256. Sharding improves full indexing speed and single-query performance. For some existing instances, ensure all tables have the same number of data shards. Alternatively, one table can have a single data shard, while all other tables must have an identical number of shards.

  • Data update resources: The number of resources used for data updates. By default, each index provides two free update resources, each with 4 vCPUs and 8 GB of memory. Resources exceeding the free quota are billed. For more information, see Billing overview of OpenSearch Vector Search Edition or .

  • Scenario template: OpenSearch Vector Search Edition provides three built-in templates: General, Vector - Image Search, and Vector - Text Semantic Template.

2. Data synchronization

Select a Full data source. Supported data sources include MaxCompute + API, Object Storage Service (OSS) + API, Synchronize OpenLake-DLF vector data to Alibaba Cloud OpenSearch, and API data source. This topic uses MaxCompute + API as an example. Configure your AccessKey, AccessKey secret, Project, Table, and Partition. Enable Automatic reindexing if needed. After configuration, click Validate in the Data Source Validation section. You can proceed only after the validation is successful.

3. Field configuration

OpenSearch Vector Search Edition pre-populates fields based on the selected scenario template and automatically imports fields from the full data source to the field list. You can also manually add fields as needed.

Preset fields for the text semantic search template:

  • id (primary key)

  • source_text (source text)

  • namespace (namespace)

  • source_text_vector (the text field to be vectorized)

Notes on field configuration:

  • A primary key field and a vector field are required. The primary key must be of type INT or STRING with the Primary key option selected. The vector field must be of type FLOAT with the Vector field option selected.

  • By default, the vector field is a multi-value FLOAT type whose values are separated by commas. You can also specify a custom multi-value separator.

  • For fields that require text vectorization, select the Embedding field option.

  • Define the fields for vector search in the following order: primary key field, namespace field (optional), and vector field.

  • In the data preprocessing settings, you can configure preprocessing for the source_text field.

Settings for source_text data preprocessing:

  • Preprocessing template: The system displays available templates based on the selected scenario template. Because you chose the Text Semantic Search-Dense Vector Retrieval template, the available preprocessing template options are Dense Vectorization and Dense + Sparse Vectorization.

  • Service list: After you select a preprocessing template, the Service list for that template appears automatically.

  • Model:

    • The text vectorization service offers two types of models: Built-in and AI Platform. Built-in models are free to use. AI Platform models from the AI Search Open Platform are a paid service, and their charges are billed separately from OpenSearch Vector Search Edition. For billing details, see Billing methods and billable items.

    • To use a model from the AI Search Open Platform, you must first create an AI Search Open Platform workspace and an API key.

  • Generated field:

    • For services that involve embedding, the generated field is created by default and cannot be deselected or deleted.

  • API call configuration: Because you are using a model service from the AI Search Open Platform, you must configure the service API call. Click Configure in the API Call Configuration section. On the configuration page that appears, set the Workspace, API key, and Endpoint. These settings need to be configured only once per table.

4. Index schema

OpenSearch automatically builds indexes on the primary key and vector fields. The index names are the same as the field names. You only need to configure the vector index in the console.

Set the Vector dimension (768 in this example), Distance type (for example, SquaredEuclidean), Vector index algorithm (for example, Qc), and Real-time index (for example, true).

Configure the Advanced configuration settings as needed. For more information, see General vector index configurations.

Note
  • The primary key field and vector field are required. The namespace field is optional and can be left empty.

  • Namespace field: If the instance engine version is vector service 1.0.2 or earlier, the namespace field does not support the STRING type. This limitation does not apply to later versions.

5. Confirm creation

Click Confirm Creation to create the table. In the left-side navigation pane, go to Log records > Change history to view the table creation progress. When the status changes to Completed, you can run a query test.

After you confirm, the system automatically starts building the index. This process takes about 2 minutes. Once complete, the index is automatically enabled in the current instance.

6. Query test

In the left-side navigation pane, go to Vector management > Query test. The query test page supports both form mode and developer mode.

6.1 Form mode

Select Form mode and a Table name. For Query type, you can choose Vector or Text. This example uses the Text type. Enter your query content in the Text field and click Search. The results are displayed in the Search result section.

6.2 Developer mode

Select Developer mode and a Table name. Enter the query parameters in the search box below. Click Search to view the search results in the Results pane on the right.

For detailed query syntax, see the syntax reference below.

Syntax reference

Vector search with an SDK

  • Query data (Perform vector and primary key queries using an SDK)

  • Update data (Add or delete records using an SDK)