All Products
Search
Document Center

OpenSearch:Clause descriptions

Last Updated:Oct 30, 2026

This topic describes the design logic and usage of the core clauses in OpenSearch Industry Algorithm Edition. By breaking the clauses down into modules, this topic helps you understand the core capabilities of each clause and how the clauses work together, so that you can quickly build efficient and flexible search solutions.

Vector retrieval

To support more diverse and complex business scenarios, OpenSearch provides the vector retrieval feature. In specific business scenarios, especially question search in education and image search, you can use vector retrieval together with the multi-channel search feature to improve the accuracy of search results. For more information, see Vector retrieval.

Index retrieval

Index retrieval includes query clause, Fuzzy search, and Range query.

  • query clause

    The query clause is an indispensable part of a search statement. It specifies the content to query and the index field in which to query it. You can specify multiple query conditions and the relationships between them (AND \ OR \ ANDNOT \ RANK).

  • Fuzzy search

    Fuzzy search means that when the search intent of a user is unclear, the search engine performs fuzzy matching between the user's query and the content to be retrieved (documents) to find content that is relevant to the query.

  • Range query

    Range queries meet the requirements for interval range queries in business scenarios.

Result filtering: filter clause

The filtering feature allows you to filter for documents of interest based on query conditions. The documents found by the query clause are further filtered to return the final results. For more information, see Result filtering: filter clause.

Aggregate statistics: aggregate clause

A keyword query may return tens of thousands of documents, and users are unlikely to browse all of them to obtain the information they need. In some cases, users may be more interested in statistics. For more information, see Group statistics: aggregate clause.

Result diversification: distinct clause

The distinct clause helps ensure the diversity of displayed results to a certain extent and improves user experience. For example, a query may return a large number of documents. If multiple documents of one user all have high scores, these documents are all ranked at the top. As a result, almost all results displayed on a page belong to the same user, which is bad for both result display and user experience. To address this issue, the distinct clause extracts documents from each user so that every user has a chance to have documents displayed. For more information, see Distinct clause for aggregation and scattering.

Global sorting: sort clause

You can use a query statement to control how results are sorted, including the fields by which results are sorted and whether results are sorted in ascending or descending order. For more information, see Global sorting: sort clause.

Custom parameters: kvpairs clause

To pass information to specific feature functions by using query statements, you can define parameters for the variable parts of sort expressions in the kvpairs clause. For more information, see Custom parameter passing - kvpair clause.

Query pagination: config clause

The config clause can specify the start position of query results, the number of results to return, the format in which results are displayed, and the number of documents involved in the fine sort expression. For more information, see Query paging - config clause.

Batch document export: scroll method

The main purpose of traditional search scenarios is to retrieve the most relevant results in the shortest possible time. Therefore, search results are limited. For example, the search method can retrieve a maximum of 5,000 documents. In some scenarios where more results are required for analysis, you can use the scroll operation to obtain more results. For more information, see Batch document export - scroll method.