> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yahont.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Отправить поисковое сообщение

> 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.

> [!NOTE]
>
> **Необходимое право:** «Поиск — чтение» (`read:search`), которое включает `basic`,
> поэтому оно есть у любого вошедшего пользователя.
> Ограниченному [персональному токену доступа](https://docs.yahont.ai/developers/overview.md#personal-access-tokens)
> нужна область «Поиск — чтение».

> [!NOTE]
>
> Это конечная точка, на которой работает интерфейс поиска Yahont.
> В отличие от [`POST /chat/send-chat-message`](https://docs.yahont.ai/developers/api_reference/chat/handle_send_chat_message),
> здесь `stream` по умолчанию равен `false`, поэтому ответ по умолчанию — агрегированный `SearchFullResponse`.
> Формат пакетов потоковой передачи см. в разделе [Поиск через API](https://docs.yahont.ai/developers/guides/search_api_guide.md).

> [!WARNING]
>
> Требуется векторная база данных: развёртывания с заданным `DISABLE_VECTOR_DB` (Yahont Lite) отвечают `501`.
> Каждый запрос вошедшего пользователя записывается в [историю
> поиска](https://docs.yahont.ai/developers/api_reference/search/get_search_history.md) этого пользователя.


## OpenAPI

````yaml POST /search/send-search-message
openapi: 3.1.0
info:
  title: Yahont API
  description: Yahont API для поиска и чата по данным компании на базе ИИ
  version: Development
servers:
  - url: https://your-yahont-domain.com/api
security: []
paths:
  /search/send-search-message:
    post:
      tags:
        - public
      summary: Handle Send Search Message
      description: >-
        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.
      operationId: handle_send_search_message
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendSearchQueryRequest'
      responses:
        '200':
          description: >-
            If `stream=true`, returns `text/event-stream`.

            If `stream=false` (the default), returns `application/json`
            (SearchFullResponse).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchFullResponse'
            text/event-stream:
              schema:
                type: string
              examples:
                stream:
                  summary: Stream of NDJSON search packets
                  value: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    SendSearchQueryRequest:
      properties:
        search_query:
          type: string
          title: Search Query
        filters:
          anyOf:
            - $ref: '#/components/schemas/BaseFilters'
            - type: 'null'
        num_docs_fed_to_llm_selection:
          anyOf:
            - type: integer
            - type: 'null'
          title: Num Docs Fed To Llm Selection
        run_query_expansion:
          type: boolean
          title: Run Query Expansion
          default: false
        num_hits:
          type: integer
          title: Num Hits
          default: 30
        hybrid_alpha:
          anyOf:
            - type: number
            - type: 'null'
          title: Hybrid Alpha
        include_content:
          type: boolean
          title: Include Content
          default: false
        stream:
          type: boolean
          title: Stream
          default: false
      type: object
      required:
        - search_query
      title: SendSearchQueryRequest
    SearchFullResponse:
      properties:
        all_executed_queries:
          items:
            type: string
          type: array
          title: All Executed Queries
        search_docs:
          items:
            $ref: '#/components/schemas/SearchDocWithContent'
          type: array
          title: Search Docs
        doc_selection_reasoning:
          anyOf:
            - type: string
            - type: 'null'
          title: Doc Selection Reasoning
        llm_selected_doc_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Llm Selected Doc Ids
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
      type: object
      required:
        - all_executed_queries
        - search_docs
      title: SearchFullResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BaseFilters:
      properties:
        source_type:
          anyOf:
            - items:
                $ref: '#/components/schemas/DocumentSource'
              type: array
            - type: 'null'
          title: Source Type
        document_set:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Document Set
        created_at_range:
          anyOf:
            - $ref: '#/components/schemas/TimeRange'
            - type: 'null'
        updated_at_range:
          anyOf:
            - $ref: '#/components/schemas/TimeRange'
            - type: 'null'
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/Tag'
              type: array
            - type: 'null'
          title: Tags
        time_cutoff:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Time Cutoff
      type: object
      title: BaseFilters
    SearchDocWithContent:
      properties:
        document_id:
          type: string
          title: Document Id
        chunk_ind:
          type: integer
          title: Chunk Ind
        semantic_identifier:
          type: string
          title: Semantic Identifier
        link:
          anyOf:
            - type: string
            - type: 'null'
          title: Link
        blurb:
          type: string
          title: Blurb
        source_type:
          $ref: '#/components/schemas/DocumentSource'
        boost:
          type: integer
          title: Boost
        hidden:
          type: boolean
          title: Hidden
        metadata:
          additionalProperties:
            anyOf:
              - type: string
              - items:
                  type: string
                type: array
          type: object
          title: Metadata
        score:
          anyOf:
            - type: number
            - type: 'null'
          title: Score
        is_relevant:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Relevant
        relevance_explanation:
          anyOf:
            - type: string
            - type: 'null'
          title: Relevance Explanation
        match_highlights:
          items:
            type: string
          type: array
          title: Match Highlights
        source_types:
          anyOf:
            - items:
                $ref: '#/components/schemas/DocumentSource'
              type: array
            - type: 'null'
          title: Source Types
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
        primary_owners:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Primary Owners
        secondary_owners:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Secondary Owners
        is_internet:
          type: boolean
          title: Is Internet
          default: false
        file_id:
          anyOf:
            - type: string
            - type: 'null'
          title: File Id
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
      type: object
      required:
        - document_id
        - chunk_ind
        - semantic_identifier
        - blurb
        - source_type
        - boost
        - hidden
        - metadata
        - match_highlights
        - content
      title: SearchDocWithContent
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    DocumentSource:
      type: string
      enum:
        - ingestion_api
        - slack
        - web
        - google_drive
        - gmail
        - github
        - gitbook
        - gitlab
        - guru
        - bookstack
        - outline
        - confluence
        - jira
        - slab
        - productboard
        - file
        - coda
        - canvas
        - notion
        - zulip
        - linear
        - hubspot
        - document360
        - gong
        - google_sites
        - zendesk
        - loopio
        - box
        - dropbox
        - sharepoint
        - onedrive
        - teams
        - outlook
        - salesforce
        - discourse
        - axero
        - clickup
        - mediawiki
        - wikipedia
        - asana
        - s3
        - r2
        - google_cloud_storage
        - oci_storage
        - s3_compatible
        - xenforo
        - not_applicable
        - discord
        - freshdesk
        - fireflies
        - zoom
        - egnyte
        - airtable
        - highspot
        - drupal_wiki
        - imap
        - yandex_mail
        - mailru_mail
        - yandex_disk
        - bitbucket
        - testrail
        - braintrust
        - lumapps
        - youtrack
        - mock_connector
        - user_file
        - craft_file
      title: DocumentSource
    TimeRange:
      properties:
        start:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Start
        end:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: End
      type: object
      title: TimeRange
      description: |-
        An inclusive [start, end] window; either bound may be None (open).
        Naive (timezone-less) bounds are treated as UTC.
    Tag:
      properties:
        tag_key:
          type: string
          title: Tag Key
        tag_value:
          type: string
          title: Tag Value
      type: object
      required:
        - tag_key
        - tag_value
      title: Tag
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Authorization header with Bearer token

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.