Quick Start

更新时间:
复制 MD 格式

This guide shows you how to quickly create an OpenSearch application and build a high-performance search service.

Prerequisites

  1. You must have an Alibaba Cloud account and have completed real-name verification.

  2. When you first log in to the Alibaba Cloud console, you are prompted to create an AccessKey.

    • You must have an AccessKey for your primary account to create and use applications.

    • After you create an AccessKey for your primary account, you can also create one for a RAM user. Grant the required permissions to the RAM user. For more information, see Access control rules.

Step 1: Purchase an application

Log in to the OpenSearch console. In the upper-left corner, select OpenSearch-High-performance Search Edition. On the instance management page, click Create Instance.

You can purchase an application with either a subscription or pay-as-you-go billing method.

On the purchase page, select a region and availability zone, such as China (Shenzhen) or China (Beijing), enter an application name (which cannot be changed after creation), and select a cluster preference (dedicated cluster - general-purpose, dedicated cluster - compute-optimized, dedicated cluster - storage-optimized, or shared cluster - general-purpose).

On the purchase page, configure the storage capacity (for example, 100 GB), compute resources (for example, 800 LCU), billing cycle (select a duration from 1 to 6 months and optionally select Auto-renewal), and resource group (defaults to the default resource group). Then, click Buy Now to place the order.

Step 2: Configure the application

After the application is initialized, its status changes to Pending. Click Configure to define the application schema.

The configuration wizard guides you through four steps: Application schemaIndex schemaData sourceFinish. In the first step, choose a method to create the application schema. Options include Create from data source, Create manually, Create from template, and Create by uploading documents. After you make a selection, click Next.

Define the application schema

You can create an application schema in one of four ways.

Methods for defining an application schema:

  1. Create an application schema from a template. You can save a configured application schema as a template to quickly create new applications.

  2. Create an application schema by uploading documents. You can upload an existing data file (JSON format only). The system automatically parses the file to create an initial application schema. You must then redefine field types and other settings.

  3. Create an application schema from a data source. This method is ideal for synchronizing data from sources like RDS and MaxCompute. It quickly creates an initial application schema from the source table schema, saving manual effort and reducing the risk of errors. This section uses RDS as an example. The process for other data sources is similar. For details, see Configure a data source.

    Select the Create from data source tab. In the Select Data Source panel that appears on the right, select RDS and click + New Database Connection.

    In the Connect to Database dialog box, enter the RDS Instance ID, Database Name, Username, and Password, and then click Connect.

  4. Manually create an application schema. Use this method if the other options do not suit your scenario.

    On the Create manually page, enter a table name (for example, main) and select Primary table. In the field definition area, set the field names (for example, id and name), select the primary key radio button for one of the fields, and choose a type for each field (such as INT or LITERAL). The selected field types affect how you configure index and attribute fields later. Click + to add more fields.

Define the index schema

  • Create an index for any field used in a query clause. Floating-point type fields cannot be created as an index. For more information, see OpenSearch table schema.

  • Create attribute fields for fields used in filter clauses, sort clauses, or functions.

  • Tokenized field types, such as TEXT and SHORT_TEXT, cannot be configured as attribute fields. Only numeric and non-tokenized field types, such as int, int_array, float, float_array, double, double_array, literal, and literal_array, can be configured as attribute fields.

    In the Index schema step, configure three sections: Index Fields, where you set the index name, included fields, and analysis method (such as chinese - general analysis or keyword), for example, query=default:"cloud search"; Attribute fields, which allows fields to be used in filter, aggregate, sort, and distinct clauses, for example, filter=id>100000; and Default Display Fields, which ensures that the values of these fields are returned in search results. After completing the configuration, click Next to configure the data source.

Synchronize the data source

  1. Associate a data source. Once associated, select the data tables, click >> to add them, and then confirm your selection.

  2. After you confirm, the field mapping page appears. Select Add Data. OpenSearch automatically maps source fields to application fields that have the same name. Manually map any fields with different names.

  3. On the field mapping page, you can also configure data source plug-ins. For more information, see the data source plug-in documentation.

    Note

    For real-time data synchronization, see DTS real-time synchronization.

  4. Complete the creation.

Step 3: Test the search

After your data is uploaded, you can test the search functionality. The OpenSearch console provides a built-in Search test page. You can configure query clauses and parameters to run tests based on your requirements (for details, see API overview and SDK introduction). This section uses the Search Test page as an example. To test your search configuration, click the + icon next to a clause or parameter, select an item from the drop-down list, enter the corresponding content, and then click Search.

Usage

  1. In the left-side navigation pane, choose Feature Extensions > Search test. Enter a query in the required query clause.

    Select Online application. In the config clause, set start:0,hit:10,format:fulljson, and then click Search to view the results.

  2. You can also add more clauses and parameters.

    Click the + icon to add a clause. You can select a filter clause, sort clause, distinct clause, aggregate clause, kvpairs clause, or config clause.

    Click the + icon next to Parameters to add a parameter. Available parameters include display fields (fetch_fields), query analysis (qp), first_rank_name (coarse-grained sort expression), second_rank_name (fine-grained sort expression), fine-grained sort plug-in type (second_rank_type), summary configuration (summary), category prediction (category_prediction), original query (raw_query), re-search policy (re_search), business information (biz), search request ID (from_request_id), user ID (user_id), A/B test (abtest), disable (disable), and custom parameters (custom).

Additional information

Clauses

Query clause: See the query clause documentation.

Filter clause: See the filter clause documentation.

Sort clause: See the sort clause documentation.

Distinct clause: See the distinct clause documentation.

Aggregate clause: See the aggregate clause documentation.

Kvpairs clause: See the kvpairs clause documentation.

Config clause: See the config clause documentation.

Parameters

Display fields (fetch_fields): Specifies the fields to return in the results. Separate multiple field names with semicolons (;).

Query analysis (qp): Specifies the name of the query analysis rule.

first_rank_name (coarse-grained sort expression): Specifies the name of the coarse-grained sorting expression.

second_rank_name (fine-grained sort expression): Specifies the name of the fine-grained sorting expression.

Summary configuration (summary): Configures the search result summary. For more information, see Search result summary.

Category prediction and original query: Specify the category prediction name and the query terms.

Re-search policy (re_search): Defines the re-search policy. For more information, see Search processing.

For Business information (biz) and the User ID, see Search processing.

A/B test: Specifies the name of the A/B test.

Disable (disable): Disables a specified feature. For example, disable=qp.

For details on advanced features, see the corresponding product documentation.