All Products
Search
Document Center

OpenSearch:General-purpose Edition template configurations

Last Updated:Feb 01, 2023

Prerequisites

  1. An Alibaba Cloud account is created and the real-name verification is complete.

  2. When you create an Alibaba Cloud account and log on to the console for the first time, you are prompted to create an AccessKey pair before you can continue.

    • You must specify the AccessKey pair for your Alibaba Cloud account because the AccessKey pair is required when you create and use an OpenSearch application.

    • After you create an AccessKey pair for your Alibaba Cloud account, you can create an AccessKey pair for a RAM user so that you can access the application as the RAM user. For more information about how to grant permissions to RAM users, see Access authorization rules.

Create an application

Procedure:

  1. Purchase an application.

  2. Configure the application in the following procedure: define an application schema, define an index schema, configure a data source, and then complete the configuration.

  3. Run a search test.

  4. Use the search algorithm center and advanced features. For example, you can analyze search results or configure sorting in the search algorithm center.

Log on to the OpenSearch Industry Algorithm Edition console. Select a region and then click Create Instance.

image

1. Purchase an application

OpenSearch supports the pay-as-you-go and subscription billing methods. You can select a region and purchase an application based on your business requirements. The following figures show the procedure for purchasing an application.

image

image

2. Configure the application

After the purchased application is initialized, the application is in the Pending state. To configure the application, click Configure in the Actions column on the Instance Management page to define an application schema.

imageimage

2.1 Define an application schema

The OpenSearch console provides four methods for you to define an application schema. An advanced application supports multiple tables, which facilitates your calls in complex business scenarios.

Rules of associating primary and secondary tables

Take note of the following rules when you manually create multiple tables to configure the schema of an application:

  • The ratio of primary table records to secondary table records must be N:1 or 1:1. The ratio of 1:N is not supported. This means that a primary table record cannot be associated with multiple secondary table records. In addition, only one table can be set as the primary table.

  • A secondary table can be associated with a primary table by associating the primary key of the secondary table with a foreign key of the primary table. The foreign key of the primary table can be associated only with the primary key of the secondary table.

  • A maximum of two levels are supported when a secondary table is associated with a primary table. Examples of supported association among multiple tables:

  • Table a -> Table b, Table b -> Table c

  • Table a -> Table d A maximum of two levels are supported when a secondary tables is associated with a primary table.

  • Table a -> Table b, Table b -> Table c, Table c -> Table d Tables cannot be associated into a loop.

  • Table a -> Table b, Table b -> Table a Data model

Procedure for defining an application schema:

1. Use a template to define an application schema. You can create a template to define a custom application schema and then use the template to create an application.

2. Use a data file to define an application schema. You can upload a data file to the OpenSearch Industry Algorithm Edition console. Then, OpenSearch automatically resolves the uploaded data file and generates an initial application schema. Note: The data file must be in the JSON format. After the initial application schema is generated, you must redefine specific attributes such as field types.

3. Use a data source to define an application schema. You can use this method if you want to synchronize data from data sources such as ApsaraDB RDS and MaxCompute data sources. The schema of a source table can be used to generate an initial application schema. This reduces workloads of manual definition and decreases the error probability. The steps of connecting to different data sources are similar. The following figures show how to connect to an ApsaraDB RDS data source. For more information, see Configure an ApsaraDB RDS for MySQL data source.

1011

4. Manually define an application schema.

12

2.2 Define an index schema

  • You must use the fields that are included in QUERY clauses to create index fields. Fields of the FLOAT type cannot be used to create index fields. For more information about how to split words, see Schema of tables for Industry Algorithm Edition.

  • You must use the following fields to create attribute fields: fields that are included in FILTER or SORT clauses, and fields that must be set to attribute fields as specified by corresponding functions.

  • You cannot create attribute fields by using fields of text types, such as TEXT and SHORT_TEXT. You can create attribute fields only by using fields of numeric types or non-text types, such as INT, INT_ARRAY, FLOAT, FLOAT_ARRAY, DOUBLE, DOUBLE_ARRAY, LITERAL, and LITERAL_ARRAY.

13

2.3 Configure a data source

Connect to a data source. Then, select one or more tables from the connected data source and click >>.

14

After you confirm your selection, click OK. Then, you can configure field mappings.

15

When you configure field mappings, you can configure a plug-in for data processing. For more information about how to use a plug-in for data processing, see Use data processing plug-ins.

16

Note

You can use Data Transmission Service (DTS) to synchronize data between various data sources in real time. For more information, see Configure DTS real-time synchronization.

2.4 Complete the configuration

17

3. Run a search test

After the data source is configured, you can start to search for data. The OpenSearch console provides the Search Test page for you to run search tests. You can configure clauses and fields to search for data based on your business requirements. The following example describes how to run a test on the Search Test page. For more information about other search methods, see API overview and SDK overview. To run a search test on the Search Test page, move the pointer over the Plus icon next to Clauses or Parameters, select a clause or field that you want to use from the drop-down list, specify the clause or field, and then click Search.

Procedure:

1. In the left-side navigation pane, choose Feature Extensions > Search Test. On the Search Test page, specify a QUERY clause for the query parameter. This is a required parameter.

image

2. Add more clauses or fields as required.

1919

Clause description

For more information about how to use QUERY clauses, see QUERY clauses.

For more information about how to use FILTER clauses, see FILTER clauses.

For more information about how to use SORT clauses, see SORT clauses.

For more information about how to use DISTINCT clauses, see DISTINCT clauses.

For more information about how to use AGGREGATE clauses, see AGGREGATE clauses.

For more information about how to use KVPAIR clauses, see KVPAIR clauses.

For more information about how to use CONFIG clauses, see CONFIG clauses.

Field description

Displayed Field - fetch_fields: Sets the fields to be displayed. Separate multiple fields with semicolons (;).

Query Analysis - qp: Sets the name of the query analysis.

Rough Sort Expression - first_rank_name: Sets the name of a rough sort.

Fine Sort Expression - second_rank_name: Sets the name of a fine sort.

Search Result Summary Configuration - summary: Configures the summary of search results. For more information, see Search result summary.

Category Prediction - category_prediction and Original Search Query - raw_query: Sets a query word and the name of category prediction.

New-search Policy - re_search: Sets a re-search policy. For more information, see Initiate search requests.

Business Information - biz and User ID - user_id: Sets business information and the user ID. For more information, see Initiate search requests.

A/B Test - abtest: Sets the name of A/B testing.

Disabled Field - disable: Disables one or more fields. Example: disable = qp.

For more information about how to use advanced features, see corresponding topics.