All Products
Search
Document Center

OpenSearch:Deep search tutorial

Last Updated:Jun 21, 2026

Deep search is a professional question and answer (Q&A) system based on a multi-agent architecture that delivers precise, focused, and detailed answers. It can efficiently retrieve data, understand user intent, integrate information from multiple sources, and generate comprehensive, structured responses. Unlike traditional search engines, deep search excels at breaking down complex questions, integrating data from multiple sources, and connecting knowledge across different domains.

Capability comparison

The following table compares deep search with traditional AI search.

Dimension

Deep search

Traditional AI search

Understanding

Contextual inference and intent recognition.

Semantic and keyword retrieval.

Response mode

Proactively asks for clarifying details, such as a time range or regional scope.

Passively accepts the original query.

Data sources

Supports cross-platform aggregation from sources such as private data, the web, and databases.

Relies on a single data source.

Knowledge density

Returns multiple cited references in a single response to accurately answer the question.

Returns only a fixed set of 3 to 5 relevant data passages.

Interaction depth

Supports continuous, multi-turn professional conversations.

The number of conversation turns significantly affects the results.

Applicable questions

Complex, open-ended questions for tasks like analysis or comparison.

Simple, fact-based questions.

Architecture

Deep search is built on a multi-agent architecture and consists of the following agents:

  • Query understanding agent: Understands and rewrites the user's original query.

  • Autonomous planning agent: Identifies user intent, plans and adjusts the execution path, and validates and corrects answers.

  • Search agent: Retrieves and summarizes knowledge for the current round of conversation.

  • Casual chat agent: Responds to conversational inputs, such as "Hello".

  • Clarification agent: Generates follow-up questions to clarify ambiguous user queries.

  • Summary agent: Generates the final answer to the user's question.

Usage

Console

1. Log in to the OpenSearch console and select OpenSearch LLM-Based Conversational Search Edition. In the left-side navigation pane, click Instance Management. Find the instance that you want to manage and click Manage in the Actions column.

2. On the instance details page, click Q&A Test. Enable Deep Search, enter your query in the dialog box, and then click Send.

3. View the Q&A test results.

API

Request parameters

Parameter

Type

Required

Default

Description

options.chat.enable_deep_search

Boolean

No

true

Specifies whether to enable deep search.

  • true: Enables deep search. The service performs multiple rounds of reasoning and synthesizes data to generate the result. A single conversation consumes more time and computing resources.

  • false: Disables deep search.

options.chat.agent.think_process

Boolean

No

true

Specifies whether to return 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 the thinking process and the answer.

AUTO: Automatically determines whether to use Chinese or English based on the user query.

CN: Chinese.

EN: English.

Note

For a complete list of Q&A test 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: The request was successful.

  • FAIL: The request failed.

latency

Float

The time required for the server to process a successful request, in milliseconds.

id

Integer

The primary key ID.

title

String

The document title.

category

String

The category name.

url

String

The document URL.

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.

A thinking round consists of THINK, ACTION, and ANSWER events, although THINK is not always returned. THINK indicates the agent is reasoning, ACTION shows the action being performed, and ANSWER provides the conclusion for that round. The SUMMARY event contains the final answer, and only one SUMMARY event is returned per request.

event_status

String

Indicates whether the result is complete.

PROCESSING: The answer is being generated.

FINISHED: The answer is complete.

code

String

The error code that is returned if an error occurs.

message

String

The error message that is returned if an error occurs.

Response body example

{
    "request_id": "f1b9*****************2853a",
    "status": "OK",
    "latency": 33967.562031,
    "result": {
        "data": [
            {
                "answer": "The user wants a recommendation of 3 Jay Chou albums. I need to first find out 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": "Here is a list of Jay Chou's albums, 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 songs mentioned in the search results are actually tracks on albums. They have been organized 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 this based on the available information, which includes several documents describing Jay Chou's albums.\n\nReviewing the information:\n- [Doc 01] lists Jay Chou's albums and songs, but it seems to only mention the 'JAY' album and lists some songs. The document starts by saying 'Jay Chou's musical works include six official solo albums and four EP albums,' but the specific album names are not fully listed. It lists songs, but only 'JAY' is explicitly mentioned as an album name.\n- [Doc 02] mentions albums like 'The Eight Dimensions,' 'Jay Chou's Bedtime Stories,' 'Fantasy,' 'Jay,' etc., and provides the years.\n- [Doc 03] is similar to [Doc 02], mentioning albums like 'Greatest Works of Art,' 'Jay Chou's Bedtime Stories,' 'Aiyo, Not Bad,' 'Opus 12,' and 'Exclamation Mark.'\n- [Doc 04] mentions 'JAY' and 'Fantasy' and describes them.\n- [Doc 05] is similar to [Doc 02] and [Doc 03], mentioning the same albums.\n\nFrom these documents, I can extract a list of Jay Chou's albums:\n- [Doc 02] and [Doc 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, [Doc 01] mentions 'JAY' 2000, and [Doc 04] also mentions 'JAY' and 'Fantasy.'\n- [Doc 02] also mentions 'The Eight Dimensions' 2002, 'Fantasy' 2001, and 'Jay' 2000 (which likely refers to 'JAY').\n\nCombining all documents, Jay Chou's albums include:\n- 'JAY' 2000 [Doc 01][Doc 04]\n- 'Fantasy' 2001 [Doc 02][Doc 04]\n- 'The Eight Dimensions' 2002 [Doc 02]\n- 'Exclamation Mark' 2011 [Doc 02][Doc 03]\n- 'Opus 12' 2012 [Doc 02][Doc 03]\n- 'Aiyo, Not Bad' 2014 [Doc 02][Doc 03]\n- 'Jay Chou's Bedtime Stories' 2016 [Doc 02][Doc 03]\n- 'Greatest Works of Art' 2022 [Doc 02][Doc 03]\n\nThe user wants a recommendation of 3 albums. I need to make recommendations based on the available information and ensure each point is supported by a source.\n\nRecommendation criteria: I should choose some classic or representative albums. From the documents:\n- [Doc 02] and [Doc 03] highly praise 'Fantasy,' calling it 'the peak of Jay Chou's musical career and a benchmark of an era that countless musicians have tried to imitate but found difficult to surpass.' [Doc 02][Doc 03]\n- [Doc 01] mentions 'JAY' as his debut album.\n- [Doc 02] mentions that 'The Eight Dimensions' continued the style of the first two albums and won multiple awards. [Doc 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 is described as a peak and a benchmark.\n2. 'JAY' - as the debut album, it has historical significance.\n3. 'The Eight Dimensions' - because it continued his success and won awards.\n\nAlternatively, I could choose more recent ones, but the documents emphasize the importance of his early albums.\n\nEnsure source citations: Every fact must be cited in the format [Doc xx].\n\nAnswer requirements:\n- Use English.\n- If the information can answer the question, it must be used, and sources must be cited.\n- Use rich markdown formats: lists, tables, etc.\n- Natural, not stiff, tone.\n- Accuracy, no fabricated information.\n\nStructuring the answer:\n- Start by directly recommending 3 albums.\n- Provide reasons for each album, based on the documents.\n- Use a list or table to organize.\n- Cite sources.\n\nFinal recommendation:\n1. 'Fantasy' (2001) - Reason: Described as the peak of Jay Chou's musical career and a benchmark of an era. [Doc 02][Doc 03]\n2. 'JAY' (2000) - Reason: Debut album that established his musical style. [Doc 01][Doc 04]\n3. 'The Eight Dimensions' (2002) - Reason: Continued the style of his previous works, won multiple awards, and brought hope to the recording industry. [Doc 02]\n\nI could also consider 'Jay Chou's Bedtime Stories' or 'Greatest Works of Art,' but there is less description of them in the documents, while the early albums have more commentary.\n\nIn [Doc 02][Doc 03], there is a detailed description of 'Fantasy,' while other albums are just listed.\n\nSo, choosing these three is reasonable.\n\nUse markdown: I can use ordered lists or tables.\n\nFor example:\n- Use ### for headings\n- Use a list for descriptions\n- Bold the album names\n\nEnsure no extra information is added: only based on the documents.\n",
                "type": "TEXT_MARKDOWN",
                "reference": [],
                "rich_text_ref": [],
                "event": "THINK",
                "event_status": "FINISHED"
            },
            {
                "answer": "\nBased on his representative albums, here are three classic works by Jay Chou that I recommend. These albums not only showcase his unique musical style (blending pop, R&B, rock, and other elements) but are also widely acclaimed for their artistic achievement and influence. These recommendations are based on the cited sources, and the reasoning for each strictly adheres to the information within those documents.\n\n### Three Recommended Jay Chou Albums\n\n1. **Fantasy (2001)**  \n   - **Reason for Recommendation**: This album is widely regarded as the pinnacle of Jay Chou's musical career. It established his creative paradigm and became a benchmark of an era that countless musicians have tried to imitate but found difficult to surpass. Each song on the album is like a lens, creating a visual through sound, taking listeners across time and space. For example, 'Love in B.C.' blends R&B and hip-hop to create a sense of a time vortex; 'Ninja' uses a single chord and Japanese imagery to enhance the feeling of being there; and 'William's Castle' uses an organ to create a mysterious medieval atmosphere. Overall, it established Jay Chou's mature style and is beloved by fans worldwide[^2^][^3^].  \n   - **Representative Songs**: 'Love in B.C.', 'Ninja', 'William's Castle' (Source: [^2^][^3^]).\n\n2. **JAY (2000)**  \n   - **Reason for Recommendation**: As Jay Chou's debut solo album, it marks the beginning of his musical career and includes several classic songs such as 'Cute Woman,' 'Perfectionism,' and 'Starry Mood.' This album showcases his unique musical talent, blending multiple elements, laying the foundation for his subsequent works, and quickly gaining widespread recognition from fans[^1^][^4^].  \n   - **Representative Songs**: 'Cute Woman,' 'Perfectionism,' 'Starry Mood' (Source: [^1^][^4^]).\n\n3. **The Eight Dimensions (2002)**  \n   - **Reason for Recommendation**: This album continues the arrangement style of his first two works with a more mature personal style, which helped Jay Chou win numerous awards and set new records in the Mandopop scene. At the same time, its high sales brought hope to a recording industry plagued by piracy. The Minnan dialect song 'Where is the Train Going' reflects Jay Chou's connection to his roots, a feature less common in his later works, highlighting his artistic depth[^2^].  \n   - **Representative Songs**: 'Where is the Train Going,' 'Secret Signal' (Source: [^2^]).\n\nThese three albums represent the breakthrough, innovation, and mature stages of Jay Chou's early career, making them an excellent starting point for understanding the essence of his music. Each one carries a unique creative story and is worth savoring!",
                "type": "TEXT_MARKDOWN",
                "reference": [
                    {
                        "title": "Who knows the names of all 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": "Jay Chou - Apple Music",
                        "category": "webSearch",
                        "url": "https://music.apple.com/cn/artist/a/300117743"
                    },
                    {
                        "title": "Summary of All Jay Chou 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"
            }
        ]
    }
}

SDK

Configure environment variables

Configure the ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables.

Important
  • An AccessKey pair for an Alibaba Cloud account has permissions for all API operations. For better security, we recommend using a RAM user for API calls and routine O&M. For more information, see Create a RAM user.

  • To create an AccessKey ID and an AccessKey secret, see Create an AccessKey.

  • If you use the AccessKey pair of a RAM user, ensure the RAM user has the AliyunOpenSearchFullAccess permission.

  • Do not hard-code your AccessKey ID and AccessKey secret in your project code. This can expose your credentials, compromising the security of all resources in your account.

  • Linux and macOS systems

    Run the following commands, replacing<access_key_id> and <access_key_secret> with your RAM user's AccessKey ID and secret.

    export ALIBABA_CLOUD_ACCESS_KEY_ID=<access_key_id> 
    export ALIBABA_CLOUD_ACCESS_KEY_SECRET=<access_key_secret>
  • Windows systems

    1. Create a file for environment variables. In the file, add the ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET variables and set them to your AccessKey ID and secret.

    2. Restart Windows to apply the changes.

Dependency

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

Sample code

The following sample code demonstrates how to make 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 = "Replace with your application name";
    private static String host = "Replace with the API endpoint of your application";
    private static String path = "/apps/%s/actions/multi-search";
    public static void main(String[] args) {
        String appPath = String.format(path, appName);
        // Set the API read timeout.
        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());
        }
    }
}