Personalized hints

更新时间:
复制 MD 格式

Overview

To meet diverse business requirements and optimize the user search experience, OpenSearch Industry Algorithm Edition provides a personalized hint feature. This feature recommends queries based on users' search interests, diversifying content discovery and ensuring they see relevant suggestions.

Procedure

  1. Log in to the OpenSearch console. In the left-side navigation pane, choose OpenSearch Industry Algorithm Edition > Search Algorithm Center > Search Guidance > Top Searches and Hints. Select the target OpenSearch application and click Create.

  2. Enter a model name, set Model Type to Personalized Hint Model, and configure the Source Period and Training Cycle for the training data. You can also set filter conditions as needed. Then, click OK.

  3. After the personalized hint model is created, click Train.

  4. If you click Train, a confirmation message appears. Click OK to start the training.

  5. The model details page opens, where you can view the model's basic information, configuration information, data verification, and training history. After training starts, the model status is "Unavailable", and the latest version status is "Updating", which indicates the model is training.

  6. When the model status changes to available and the latest version status changes to Trained and Ready, training is complete. You can then click Preview Effects to check the results.

  7. In the Preview Effects window, enter a userId and click Preview. The personalized hint query results for the user are then displayed in a table at the bottom of the page. The table contains the hint number and hint query columns.

Note:

  • In Search Processing, you must include the userId and raw_query parameters. For better results, we recommend using data collection 2.0 to upload user behavior data, such as exposures and clicks.

  • The personalized hint feature is available only for OpenSearch Industry Algorithm Edition instances of the exclusive cluster specification or higher.

  • Training personalized hint models incurs separate charges. For more information, see Billing of OpenSearch Industry Algorithm Edition.

  • You can create up to five personalized hint training models for each OpenSearch instance.

  • To manually adjust the personalized hint results, configure blacklists and whitelists.

Get hint results with API/SDK

For more information about API calls, see Top Searches and Hints.

The following code is a Java SDK demo:

import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.aliyun.opensearch.OpenSearchClient;
import com.aliyun.opensearch.sdk.generated.OpenSearch;
import com.aliyun.opensearch.sdk.generated.commons.OpenSearchClientException;
public class Hint {
    private static final String accesskey = "Replace with your AccessKey ID";
    private static final String secret = "Replace with your AccessKey secret";
    private static final String host = "Replace with your endpoint";//For example: http://opensearch-cn-hangzhou.aliyuncs.com
    private static final String appName = "Replace with your OpenSearch application name";
    private static final String HOT_API_PATH = "/apps/{app_name}/actions/hint";
    public static void main(String[] args) {
        OpenSearch openSearch = new OpenSearch(accesskey, secret, host);
        // Create OpenSearchClient
        OpenSearchClient client = new OpenSearchClient(openSearch);
        String requestPath = HOT_API_PATH.replaceAll(("\\{app_name\\}"), appName);
        Map<String, String> params = new HashMap<>();
        params.put("model_name", "your_model_name");//Set the model name.
        params.put("hit", "10");//Set the number of hint queries to return.
        params.put("user_id", "123456");//Set the user ID.
        try {
            String response = client.call(requestPath, params, OpenSearchClient.METHOD_GET);
            System.out.println(JSON.toJSONString(response));
        } catch (OpenSearchClientException e) {
            e.printStackTrace();
        }
    }
}