All Products
Search
Document Center

OpenSearch:Best practices for deep search

Last Updated:Jul 24, 2025

The deep search feature provides a professional knowledge Q&A system based on the multi-agent architecture. It is designed to deliver accurate, focused, and comprehensive in-depth answers. It efficiently retrieves data, understands user intent, integrates information from multiple sources, and generates comprehensive structured answers. Compared with traditional search engines, this feature excels at breaking down complex questions, integrating multi-source data, and associating cross-domain knowledge.

Comparison

The following table shows compares deep search to traditional AI search.

Dimension

Deep search

Traditional AI search

Understanding capability

Contextual inference and intent recognition.

Semantic retrieval and keyword retrieval.

Response mode

Proactively asks for contextual details (such as time range, regional limits).

Passively accepts original questions.

Data source

Supports cross-platform aggregation (such as private domains, Internet, databases).

Relies on a single data source.

Knowledge density

Outputs multiple annotated references in a single response until the question is accurately answered.

Only provides 3-5 related data segments.

Interaction depth

Supports continuous multi-round professional conversations.

Depends on number of rounds in reasoning.

Applicable questions

Complex, open-ended questions (such as analysis, comparison).

Simple, factual questions.

Architecture

Deep search is based on multi-agent architecture. It consists of the following single agents:

  • Query understanding agent: understands and rewrites the original query.

  • Autonomous planning agent: identifies query intent, plans and adjusts execution paths, and corrects answers.

  • Search agent: performs knowledge retrieval and summarization in the current round.

  • Casual conversation agent: responds to casual conversations, such as "Hello".

  • Clarification agent: generates follow-up questions to clarify ambiguous questions.

  • Summary agent: provides a final answer to the question.

Sample

Console

1. Log on to the OpenSearch console, select OpenSearch LLM-Based Conversational Search Edition. Click Instance Management on the left-side navigation pane, then click Manage.

image

2. On the instance details page, click Q&A Test, enable Deep Search. Then enter your question in the dialog box, and click Send.

2

3. View the Q&A response.

3

Call from API

Parameters

Parameter

Type

Required

Default value

Description

options.chat.enable_deep_search

Boolean

No

true

Specifies whether to enable the deep search feature.

  • true: enables the deep search feature. This will enable multiple rounds of inference A single conversation consumes a relatively large amount of time and computing resources.

  • false: disables the deep search feature.

options.chat.agent.think_process

Boolean

No

true

Specifies whether to display the thinking process.

options.chat.agent.max_think_round

Integer

No

10

The number of thinking rounds (maximum 20).

options.chat.agent.language

String

No

AUTO

The language for thinking process and answer.

AUTO: choose Chinese or English by query.

CN: Chinese.

EN: English.

Note

For information about complete Q&A parameters, see Q&A parameters.

Request body example

{
    "question" : {
        "text" : "Recommend 3 Jay Chou albums",
        "type" : "TEXT"
    },
    "options": {
      "retrieve": {
      "web_search": {
        "enable": true
        }
      },
      "chat": {
        "enable_deep_search": true,
        "model": "qwen3-235b-a22b"
      },
      "agent": {
        "think_process": true,
        "max_think_round": 10,
        "language": "AUTO"
      }
    }
  }

Response parameters

Parameter

Type

Description

request_id

String

The request ID.

status

String

The processing status of the request.

  • OK: indicates that the request is successful.

  • FAIL: indicates that the request failed.

latency

Float

The time of a successful request, consumed by the server. Unit: milliseconds.

id

Integer

The primary key ID.

title

String

The title of the document.

category

String

The category name.

url

String

The document link.

answer

String

The Q&A result.

type

String

The type of the returned result.

scores

Array

The document content score.

event

String

The thinking event.

THINK+ACTION+ANSWER is one round (THINK is not guaranteed to be displayed). THINK indicates thinking, ACTION indicates the action performed, and ANSWER indicates the conclusion of this round of thinking. SUMMARY is the final result, only one for text type.

event_status

String

Indicates whether the result is complete.

PROCESSING: answering in progress.

FINISHED: answering completed.

code

String

The error code (not returned if there is no error).

message

String

The error message (not returned if there is no error).

Response body example

{
    "request_id": "f1b9*****************2853a",
    "status": "OK",
    "latency": 33967.562031,
    "result": {
        "data": [
            {
                "answer": "The user is asking for recommendations for 3 Jay Chou albums. I need to first understand what albums Jay Chou has, and then select 3 representative ones to recommend.",
                "type": "TEXT_MARKDOWN",
                "reference": [],
                "rich_text_ref": [],
                "event": "THINK",
                "event_status": "FINISHED"
            },
            {
                "answer": "List of all Jay Chou albums",
                "type": "TEXT_MARKDOWN",
                "reference": [],
                "rich_text_ref": [],
                "event": "ACTION",
                "event_status": "FINISHED"
            },
            {
                "answer": "Jay Chou's album list (sorted by release year):  \n\n1. **《JAY》** (2000)  \n2. **《Fantasy》** (2001)  \n3. **《The Eight Dimensions》** (2002)  \n4. **《Ye Hui Mei》** (2003)  \n5. **《Common Jasmine Orange》** (2004)  \n6. **《November's Chopin》** (2005)  \n7. **《Still Fantasy》** (2006)  \n8. **《On the Run》** (2007)  \n9. **《Capricorn》** (2008)  \n10. **《The Era》** (2010)  \n11. **《Exclamation Mark》** (2011)  \n12. **《Opus 12》** (2012)  \n13. **《Aiyo, Not Bad》** (2014)  \n14. **《Jay Chou's Bedtime Stories》** (2016)  \n15. **《Greatest Works of Art》** (2022)  \n\nNote: Some search results mentioned songs that are actually tracks within albums. I have organized them into a complete album list.",
                "type": "TEXT_MARKDOWN",
                "reference": [],
                "rich_text_ref": [],
                "event": "ANSWER",
                "event_status": "FINISHED"
            },
            {
                "answer": "\nFirst, the user's question is: \"Recommend 3 Jay Chou albums\". I need to answer based on known information. The known information includes multiple documents describing Jay Chou's albums.\n\nReviewing the known information:\n- [Document 01] lists Jay Chou's albums and songs, but seems to only mention the \"JAY\" album and lists some songs. The document begins by saying \"Jay Chou's musical works include six official personal albums and four EP albums\", but doesn't completely list the specific album names. It lists songs, but only \"JAY\" is explicitly mentioned as an album name.\n- [Document 02] mentions albums such as \"The Eight Dimensions\", \"Jay Chou's Bedtime Stories\", \"Fantasy\", \"Jay\" and provides years.\n- [Document 03] is similar to [Document 02], mentioning albums like \"Greatest Works of Art\", \"Jay Chou's Bedtime Stories\", \"Aiyo, Not Bad\", \"Opus 12\", \"Exclamation Mark\".\n- [Document 04] mentions \"JAY\" and \"Fantasy\" and describes them.\n- [Document 05] is similar to [Document 02] and [Document 03], mentioning the same albums.\n\nFrom these documents, I can extract Jay Chou's album list:\n- [Document 02] and [Document 03] clearly list album names and years:\n  - \"Greatest Works of Art\" 2022\n  - \"Jay Chou's Bedtime Stories\" 2016\n  - \"Aiyo, Not Bad\" 2014\n  - \"Opus 12\" 2012\n  - \"Exclamation Mark\" 2011\n- Additionally, [Document 01] mentions \"JAY\" 2000, [Document 04] also mentions \"JAY\" and \"Fantasy\".\n- [Document 02] also mentions \"The Eight Dimensions\" 2002, \"Fantasy\" 2001, \"Jay\" 2000 (possibly referring to \"JAY\").\n\nCombining all documents, Jay Chou's albums include the following:\n- \"JAY\" 2000 [Document 01][Document 04]\n- \"Fantasy\" 2001 [Document 02][Document 04]\n- \"The Eight Dimensions\" 2002 [Document 02]\n- \"Exclamation Mark\" 2011 [Document 02][Document 03]\n- \"Opus 12\" 2012 [Document 02][Document 03]\n- \"Aiyo, Not Bad\" 2014 [Document 02][Document 03]\n- \"Jay Chou's Bedtime Stories\" 2016 [Document 02][Document 03]\n- \"Greatest Works of Art\" 2022 [Document 02][Document 03]\n\nThe user asks for 3 album recommendations. I need to base my recommendations on known information and ensure each point has source support.\n\nRecommendation criteria: I should select some classic or representative albums. From the documents:\n- [Document 02] and [Document 03] highly praise \"Fantasy\", calling it \"the peak of Jay Chou's music career and a benchmark of the era that many musicians have tried to imitate but found difficult to surpass.\" [Document 02][Document 03]\n- [Document 01] mentions \"JAY\" as the first album.\n- [Document 02] mentions that \"The Eight Dimensions\" continued the style of the first two albums and won multiple awards. [Document 02]\n- Other albums like \"Jay Chou's Bedtime Stories\" and \"Greatest Works of Art\" are also mentioned.\n\nSo, I can recommend:\n1. \"Fantasy\" - because it's described as a peak and benchmark.\n2. \"JAY\" - as the first album, it has historical significance.\n3. \"The Eight Dimensions\" - because it continued the success and won awards.\n\nOr, I could choose more recent ones, but the documents emphasize the importance of early albums.\n\nEnsuring source citations: Each fact must be cited in [Document xx] format.\n\nAnswer requirements:\n- Use Chinese.\n- If known information can answer the question, must use known information and cite sources.\n- Use rich markdown formatting: such as lists, tables, etc.\n- Natural tone, not stiff.\n- Accuracy, don't fabricate information.\n\nStructure the answer:\n- Begin by directly recommending 3 albums.\n- Provide reasons for each album, based on documents.\n- Organize using lists or tables.\n- Cite sources.\n\nFinal recommendations:\n1. \"Fantasy\" (2001) - Reason: Described as the peak of Jay Chou's music career and a benchmark of the era. [Document 02][Document 03]\n2. \"JAY\" (2000) - Reason: First album, established his music style. [Document 01][Document 04]\n3. \"The Eight Dimensions\" (2002) - Reason: Continued the style of previous works, won multiple awards, brought hope to the record industry. [Document 02]\n\nOr, consider \"Jay Chou's Bedtime Stories\" or \"Greatest Works of Art\", but the documents have less description of them, while early albums have more evaluations.\n\nIn [Document 02][Document 03], there is a detailed description of \"Fantasy\", other albums are just listed.\n\nSo, choosing these three is reasonable.\n\nUse markdown: Can use ordered lists or tables.\n\nFor example:\n- Use ### for titles\n- List descriptions\n- Bold album names\n\nEnsure no additional information is added: only based on documents.\n",
                "type": "TEXT_MARKDOWN",
                "reference": [],
                "rich_text_ref": [],
                "event": "THINK",
                "event_status": "FINISHED"
            },
            {
                "answer": "\nBased on Jay Chou's music career, I recommend three classic albums that showcase his unique musical style (combining pop, R&B, rock and other elements). These albums are widely acclaimed for their artistic achievements and influence. My recommendations are based on reliable document information, with each recommendation reason strictly based on relevant document content and source notation (such as [Document xx]).\n\n### Three recommended Jay Chou albums\n\n1. **《Fantasy》 (2001)**  \n   - **Recommendation reason**: This album is recognized as the peak of Jay Chou's music career, establishing his creative paradigm and becoming a benchmark of the era that many musicians have tried to imitate but found difficult to surpass. Each song in the album is like a camera lens, creating images through sound, taking listeners through ancient and modern times, such as \"Love Before BC\" combining R&B and hip-hop to create a sense of time-space vortex; \"Ninja\" using a single chord and Japanese imagery to enhance presence; \"William Castle\" using organ playing to create an eerie medieval atmosphere. Overall, it established Jay Chou's mature methodology and is loved by fans globally[^2^][^3^].  \n   - **Representative songs**: \"Love Before BC\", \"Ninja\", \"William Castle\" (Source: [^2^][^3^]).\n\n2. **《JAY》 (2000)**  \n   - **Recommendation reason**: As Jay Chou's first personal album, it marks the beginning of his music career and includes many classic songs such as \"Cute Woman\", \"Perfectionism\", and \"Starry Mood\". This album showcases Jay Chou's unique musical talent, combining multiple elements, setting the tone for subsequent works, and quickly winning widespread recognition from fans[^1^][^4^].  \n   - **Representative songs**: \"Cute Woman\", \"Perfectionism\", \"Starry Mood\" (Source: [^1^][^4^]).\n\n3. **《The Eight Dimensions》 (2002)**  \n   - **Recommendation reason**: This album continues the arrangement style of the first two albums, with a more mature personal style, helping Jay Chou win multiple awards and creating new records in Chinese music. At the same time, its high sales brought hope to the record industry that was troubled by piracy at that time. The Hokkien song \"Where Is The Train Going\" in the album reflects Jay Chou's hometown sentiment, which is rare in his later works, highlighting his artistic depth[^2^].  \n   - **Representative songs**: \"Where Is The Train Going\", \"Secret Code\" (Source: [^2^]).\n\nThese three albums represent the breakthrough, innovation, and maturity stages of Jay Chou's early career and are excellent starting points for understanding his musical essence. Each album carries unique creative stories worth savoring!",
                "type": "TEXT_MARKDOWN",
                "reference": [
                    {
                        "title": "Who knows all the names of Jay Chou's albums",
                        "category": "webSearch",
                        "url": "https://zhidao.baidu.com/question/317142607014917724.html"
                    },
                    {
                        "title": "Jay Chou",
                        "category": "webSearch",
                        "url": "https://music.apple.com/cn/artist/300117743"
                    },
                    {
                        "title": "\u200eJay Chou-Apple Music",
                        "category": "webSearch",
                        "url": "https://music.apple.com/cn/artist/a/300117743"
                    },
                    {
                        "title": "Complete list of Jay Chou's album names",
                        "category": "webSearch",
                        "url": "https://m.xueba5.com/xw/25426.html"
                    },
                    {
                        "title": "Jay Chou",
                        "category": "webSearch",
                        "url": "https://music.apple.com/cn/artist/%E5%91%A8%E6%9D%B0%E4%BC%A6/300117743"
                    }
                ],
                "rich_text_ref": [],
                "event": "SUMMARY",
                "event_status": "FINISHED"
            }
        ]
    }
}

Call from SDK

Configure environment variables

Configure the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET.

Important
  • The AccessKey of an Alibaba Cloud account has permissions to call all API operations. We recommend that you use a RAM user to call API operations or perform routine O&M. For more information, see Create a RAM user.

  • For information about how to create an AccessKey ID and an AccessKey secret, see Create an AccessKey.

  • If you use the AccessKey of a RAM user, make sure that the RAM user is granted the AliyunOpenSearchFullAccess permission.

  • Do not save your AccessKey Pair in your project code. Otherwise, your AccessKey may be leaked. It threatens the security of all resources under your account.

  • Configuration method for Linux and macOS:

    Replace <access_key_id> with the AccessKey ID of your RAM user and <access_key_secret> with the AccessKey Secret of your RAM user.

    export ALIBABA_CLOUD_ACCESS_KEY_ID=<access_key_id> 
    export ALIBABA_CLOUD_ACCESS_KEY_SECRET=<access_key_secret>
  • Configuration method for Windows:

    1. Create an environment variable file, add the environment variables ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET, and write the prepared AccessKey ID and AccessKey secret.

    2. Restart the Windows.

Add a dependency

<dependency>
        <groupId>com.aliyun.opensearch</groupId>
        <artifactId>aliyun-sdk-opensearch</artifactId>
        <version>6.0.0</version>
</dependency>

Code

Refer to the following sample code to complete the call.

package com.aliyun.opensearch;

import com.aliyun.opensearch.OpenSearchClient;
import com.aliyun.opensearch.sdk.generated.OpenSearch;
import com.aliyun.opensearch.sdk.generated.commons.OpenSearchClientException;
import com.aliyun.opensearch.sdk.generated.commons.OpenSearchException;
import com.aliyun.opensearch.sdk.generated.commons.OpenSearchResult;

import java.util.HashMap;
import java.util.Map;

public class LLMSearch {
    private static String accesskey = System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID");
    private static String secret = System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET");
    
    private static String appName = "The application name.";
    private static String host = "The API endpoint of the application.";
    private static String path = "/apps/%s/actions/multi-search";

    public static void main(String[] args) {

        String appPath = String.format(path, appName);
        //ApiReadTimeOut
        OpenSearch openSearch = new OpenSearch(accesskey, secret, host);
        openSearch.setTimeout(90000);

        OpenSearchClient openSearchClient = new OpenSearchClient(openSearch);

        Map<String, String> params = new HashMap<String, String>() {{
            put("format", "full_json");
            put("_POST_BODY", "{\"question\":{\"text\":\"Recommend 3 Jay Chou albums\",\"type\":\"TEXT\",\"session\":\"\"},\"options\":{\"chat\":{\"stream\":true,\"enable_deep_search\":true,\"model\":\"opensearch-qwen\"}}}");

        }};
        try {
            OpenSearchResult openSearchResult = openSearchClient
                    .callAndDecodeResult(appPath, params, "POST");
            System.out.println("RequestID=" + openSearchResult.getTraceInfo().getRequestId());
            System.out.println(openSearchResult.getResult());
        } catch (
                OpenSearchException e) {
            System.out.println("RequestID=" + e.getRequestId());
            System.out.println("ErrorCode=" + e.getCode());
            System.out.println("ErrorMessage=" + e.getMessage());
        } catch (
                OpenSearchClientException e) {
            System.out.println("ErrorMessage=" + e.getMessage());
        }
    }
}