Clause description

Updated at:

This topic systematically describes the design logic and usage of the core clauses in OpenSearch Industry Algorithm Edition. By breaking the functionality 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-based retrieval

To meet 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 combine vector retrieval with multi-channel search to improve the accuracy of search results. For more information, see Vector retrieval.

Index-based retrieval

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

  • query clause

    The query clause is an indispensable part of a search statement. It specifies what content to query in which index field. You can also specify multiple query conditions and the relationships among 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 requirement for interval-based queries in business scenarios.

Result filtering - filter clause

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

Group statistics - aggregate clause

A keyword query may find 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 care more about statistical data. For more information, see Group statistics: aggregate clause.

Result diversification - distinct clause

The distinct clause can ensure the diversity of displayed results to a certain extent and improve user experience. For example, a query may return many documents. If multiple documents of a single user all have relatively high scores, they are all ranked at the top. As a result, almost all results displayed on a page belong to the same user, which is detrimental to 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 query statements to control how results are sorted, including the fields to sort by and whether to sort in ascending or descending order. For more information, see Global sorting: sort clause.

Custom parameters - kvpairs clause

To make it easier to pass information to specific feature functions through 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 of displayed results, the number of documents involved in the fine sort expression, and more. For more information, see Query paging - config clause.

Batch export documents - scroll method

The main purpose of traditional search scenarios is to retrieve the best-matching 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, more results are required for analysis. In this case, you can use the scroll operation to obtain more results. For more information, see Batch document export - scroll method.