OpenSearch Industry Algorithm Edition structures search requests as a set of composable clauses. Each clause controls a distinct aspect of search behavior — what to retrieve, how to filter and rank results, and how to shape the response. Understanding what each clause does and when to use it lets you build precise, efficient search requests.
Vector retrieval
Vector retrieval finds semantically similar content based on embedding vectors rather than keyword matching. It works well when the search intent is hard to express as exact terms — such as question-and-answer search and image similarity search. Combine vector retrieval with multimodal search to improve relevance in these scenarios. For more information, see Vector retrieval.
Index retrieval
-
Query clause
A query clause defines what to search for in a specific index field. It is the core of every search request. Combine multiple query conditions using logical operators — AND, OR, ANDNOT, and RANK — to express complex retrieval logic. For more information, see query clause.
-
Fuzzy search
Fuzzy search retrieves documents that approximately match a query, making it useful when the search intent is unclear or the exact term is unknown. For more information, see Fuzzy searches.
-
Range search
Range search retrieves documents whose field values fall within a specified range — for example, prices between 100 and 500, or dates in the past 30 days. For more information, see Range query.
Result filter - filter clause
A filter clause narrows the result set to documents that meet exact conditions — for example, a specific category, status, or price range. Unlike a query clause, a filter clause does not affect relevance scores, and OpenSearch caches frequently used filters to improve performance. Use a filter clause when you need a binary yes/no match rather than a ranked relevance match. For more information, see Result filter - filter clause.
Group statistics - aggregate clause
An aggregate clause computes statistics over the matching documents — such as total counts, field value distributions, or min/max values — without requiring you to page through every result. Use it when you need a summary view of the result set rather than individual documents. For more information, see Group statistics - aggregate clause.
Aggregation and discretization - distinct clause
A distinct clause groups and limits results by a specified field, preventing any single field value from dominating the result page. It covers two common scenarios:
Deduplication: Collapse multiple results with the same field value into one, so each unique value gets a slot on the page.
Skew correction: Cap the number of results from any one value to keep the result set varied — for example, limiting results from a single seller to three per page.
For more information, see Distinct clause.
Global sorting - sort clause
A sort clause orders results by one or more fields in ascending or descending order. When multiple sort fields are specified, they are evaluated in priority order: the first field sorts all results, and each subsequent field serves as a tie-breaker for documents with equal values in the preceding field. For more information, see Global sorting - sort clause.
Custom parameter passing - kvpair clause
A kvpair clause passes key-value parameters to the mutable part of a sort expression at query time, letting you inject runtime field values into custom ranking functions without modifying the expression itself. For more information, see Custom parameter passing - kvpair clause.
Query paging - config clause
A config clause controls the shape and size of the response: the offset of the first returned document, the number of documents to return, the response data format, and the number of documents considered for fine-sort ranking. For more information, see Query paging - config clause.
Batch document export - scroll search
Regular searches are optimized for speed and cap results at 5,000 documents. Scroll search removes this cap, making it suitable for bulk data export and offline analysis jobs that need the full result set. Scroll search keeps a search context open on the server, consuming memory for the duration of the scroll. Avoid scroll search for interactive user queries; for user-facing pagination, use the sort clause with an offset parameter instead. For more information, see Batch document export - Scroll searches.