public

Handle Send Search Message

Executes a search query with optional streaming.

If hybrid_alpha is unset and ONYX_SEARCH_UI_USES_OPENSEARCH_KEYWORD_SEARCH is True, executes pure keyword search.

Returns: StreamingResponse with SSE if stream=True, otherwise SearchFullResponse.

post/search/send-search-message

Request body

search_querystring required

The query to search for.

num_docs_fed_to_llm_selectioninteger nullable

When set to 1 or more, the top N merged sections are handed to an LLM that picks the most relevant ones, and their document ids come back in llm_selected_doc_ids. Omit it (or send null) to skip LLM selection and the extra LLM call it costs.

run_query_expansionboolean

When true, an LLM generates extra keyword queries from search_query. Every query runs in parallel and the results are merged with weighted reciprocal-rank fusion, with the original query weighted twice as heavily as each expansion. The queries that actually ran come back in all_executed_queries. Expansion failures are non-fatal: the original query still runs on its own.

num_hitsinteger

Maximum number of merged sections to return.

hybrid_alphanumber nullable

Balance between vector and keyword matching, from 0.0 (pure keyword) to 1.0 (pure vector). Leave unset to use the deployment's HYBRID_ALPHA (0.5 by default) — except on deployments configured for OpenSearch keyword search, where leaving it unset runs a pure keyword search.

include_contentboolean

When true, each returned document carries the full text of the matched section in content. When false, content is null and only blurb is populated.

streamboolean

When true, responds with a stream of newline-delimited JSON packets. When false (the default), returns the aggregated SearchFullResponse.

Response

If stream=true, returns text/event-stream. If stream=false (the default), returns application/json (SearchFullResponse).

all_executed_queriesstring[] required

Every query that was run, starting with the original. Contains more than one entry only when run_query_expansion was set.

doc_selection_reasoningstring nullable

Reserved for the LLM's document-selection reasoning. Not currently populated — always null on this endpoint.

llm_selected_doc_idsstring[] nullable

Document ids the LLM picked out of search_docs. null when LLM selection was not requested or failed, an empty list when it ran and chose nothing.

errorstring nullable

Set when the search failed partway through; the other fields hold whatever was gathered before the failure.

Changes

Changed in 1 of the 14 revisions of this API.1