All Products
Search
Document Center

OpenSearch:Clauses

Last Updated:Mar 05, 2025

This topic systematically analyzes the design logic and application methods of the core functional clauses in OpenSearch Industry Algorithm Edition. This way, you can better understand the core capabilities and collaborative mechanisms of each clause and quickly build efficient and flexible search solutions.

Vector retrieval

To meet more diversified and complex business requirements, OpenSearch provides the vector search feature. In specific scenarios, especially test question search and image search scenarios, you can use the vector search feature together with the multimodal search feature to improve the accuracy of search results. For more information, see Vector retrieval.

Index retrieval

  • query clause

    A query clause is an essential part of a search query. A query clause defines the specific content to be queried based on a specific index field. You can specify multiple query conditions and define their relationships by using logical operators such as AND, OR, ANDNOT, and RANK. For more information, see query clause.

  • Fuzzy search

    Fuzzy searches are applicable if the search intent is unclear. In fuzzy searches, the system retrieves the documents that are relevant to search queries in fuzzy match mode. For more information, see Fuzzy searches.

  • Range search

    Range searches are applicable if you want to search for items within a specific range. For more information, see Range search.

Result filter - filter clause

A filter clause allows you to specify filter conditions based on your business requirements to search for documents. You can use a filter clause to filter documents that are queried by using a query clause to retrieve required documents. For more information, see Result filter - filter clause.

Group statistics - aggregate clause

Tens of thousands of documents may be retrieved based on a single search query. However, you may not want to view all the retrieved documents to obtain the required information. If you want to view some statistics of the retrieved documents, you can use an aggregate clause to obtain the statistics. For more information, see Group statistics - aggregate clause.

Aggregation and discretization - distinct clause

A distinct clause can be used to ensure diversified results. This improves user experience. For example, a large number of documents are retrieved in a query. If multiple documents of a specific user are highly scored and ranked in the front, most of the results displayed on the same page are from the same user. This affects the display effect and user experience. In this case, distinct clauses can be used to extract documents from each user so that the documents of each user can be displayed. For more information, see Aggregation and discretization - distinct clause.

Global sorting - sort clause

You can specify a sort clause to sort query results in ascending order or descending order based on the specified fields. For more information, see Global sorting - sort clause.

Custom parameter passing - kvpair clause

You can use a kvpair clause to assign values to fields that are referenced in the mutable part of a sort expression. This way, you can pass field values to specific feature functions by using a query clause. For more information, see Custom parameter passing - kvpair clause.

Query paging - config clause

A config clause is used to specify configurations such as the position of the first document to be returned, the number of documents to be returned, the data format of return results, and the number of documents to be sorted by a fine sort expression. For more information, see Query paging - config clause.

Batch document export - Scroll search

For regular searches, the purpose is to retrieve the most matched results in the shortest period of time possible. Therefore, the number of documents that can be contained in return results is limited. For example, the return results of a regular search cannot contain more than 5,000 documents. However, in some scenarios, you may need more results for analysis. In this case, you can use scroll searches to obtain more results. For more information, see Batch document export - Scroll searches.