The Open API specification for Synapse is now available for download!

Download Open API Spec

SearchQuery

org.sagebionetworks.repo.model.search.SearchQuery

The body of an OpenSearch _search request, narrowed to the top-level keys Synapse accepts. Each slot's contents are pass-through OpenSearch query DSL; see the search REST endpoint for the inner-clause allowlist, field-reference rules, pagination semantics, and per-request limits.

Field Type Description
query Query

A single OpenSearch query DSL clause. Exactly one of the properties below may be set — the set property names the clause kind. See query vs. filter context and term-level vs. full-text queries.

The field-keyed leaf clauses (match, term, range, ...) are maps whose key is the column name and whose value is the per-field options object — only the long form is accepted (e.g. {"match":{"title":{"query":"x"}}}, not the {"match":{"title":"x"}} shorthand). The compound clauses (bool, dis_max, ...) nest further Query DSL clauses recursively.

post_filter Query

A single OpenSearch query DSL clause. Exactly one of the properties below may be set — the set property names the clause kind. See query vs. filter context and term-level vs. full-text queries.

The field-keyed leaf clauses (match, term, range, ...) are maps whose key is the column name and whose value is the per-field options object — only the long form is accepted (e.g. {"match":{"title":{"query":"x"}}}, not the {"match":{"title":"x"}} shorthand). The compound clauses (bool, dis_max, ...) nest further Query DSL clauses recursively.

aggregations MAP<STRING,Aggregation>

Optional. Map of caller-chosen name to aggregation definition. The raw aggregation result comes back on SearchQueryResults.aggregationResults. For the facet-counting pattern (a terms aggregation alongside post_filter), see the faceted search tutorial.

highlight Highlight A highlight block. Adds matched-term snippet fragments to each hit. Top-level options apply to every highlighted field unless overridden in a per-field block under fields.
collapse FieldCollapse A collapse block. Returns only the top hit per distinct value of field, deduplicating the result list.
rescore Rescore A rescore stage. Re-ranks the top window_size hits from the main query using a secondary scoring query. A single stage is supported.
sort ARRAY<OBJECT> Optional. Result ordering, in native OpenSearch sort shape (a string column name, {column: "asc|desc"}, or {column: {order: ..., mode: ..., missing: ...}}) applied in order. Only the field and _score sort kinds are accepted — script and geo-distance sorts are rejected server-side. The pseudo-column _score sorts by relevance. When omitted, results are sorted by relevance descending.
_source SourceFilter A source filter selecting which columns are returned on each hit. Carried as the SearchQuery _source field. Only this typed {includes, excludes} form is accepted — the boolean (true / false) and bare-array shorthands are not.
from INTEGER Optional. Zero-based pagination offset; default 0. Ignored when search_after is supplied (the cursor determines the page start).
size INTEGER Optional. Maximum number of hits to return per page. Default: 25. Maximum: 100 (larger values are silently capped).
search_after ARRAY<OBJECT> Optional. Opaque cursor emitted as nextSearchAfter on the previous response. Pass back unchanged. When supplied, from is ignored.