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

# Handle Search Request

> Simple search endpoint, does not create a new message or records in the DB



## OpenAPI

````yaml POST /api/query/document-search
openapi: 3.1.0
info:
  title: Hymalaia Chat API
  description: API for interacting with Hymalaia's chat and messaging services
  version: 1.0.0
  contact:
    name: Hymalaia Support
    email: support@hymalaia.com
    url: https://hymalaia.com
servers:
  - url: https://staging.hymalaia.app/
    description: Staging Server
security: []
paths:
  /api/query/document-search:
    post:
      tags:
        - public
      summary: Handle Search Request
      description: >-
        Simple search endpoint, does not create a new message or records in the
        DB
      operationId: handle_search_request
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentSearchRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentSearchResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    DocumentSearchRequest:
      properties:
        chunks_above:
          anyOf:
            - type: integer
            - type: 'null'
          title: Chunks Above
        chunks_below:
          anyOf:
            - type: integer
            - type: 'null'
          title: Chunks Below
        full_doc:
          type: boolean
          title: Full Doc
          default: false
        message:
          type: string
          title: Message
        search_type:
          $ref: '#/components/schemas/SearchType'
        retrieval_options:
          $ref: '#/components/schemas/RetrievalDetails'
        recency_bias_multiplier:
          type: number
          title: Recency Bias Multiplier
          default: 1
        evaluation_type:
          $ref: '#/components/schemas/LLMEvaluationType'
        rerank_settings:
          anyOf:
            - $ref: '#/components/schemas/RerankingDetails'
            - type: 'null'
      type: object
      required:
        - message
        - search_type
        - retrieval_options
        - evaluation_type
      title: DocumentSearchRequest
    DocumentSearchResponse:
      properties:
        top_documents:
          items:
            $ref: '#/components/schemas/SavedSearchDocWithContent'
          type: array
          title: Top Documents
        llm_indices:
          items:
            type: integer
          type: array
          title: Llm Indices
        pagination:
          $ref: '#/components/schemas/DocumentSearchPagination'
      type: object
      required:
        - top_documents
        - llm_indices
        - pagination
      title: DocumentSearchResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SearchType:
      type: string
      enum:
        - keyword
        - semantic
        - internet
      title: SearchType
    RetrievalDetails:
      properties:
        chunks_above:
          anyOf:
            - type: integer
            - type: 'null'
          title: Chunks Above
        chunks_below:
          anyOf:
            - type: integer
            - type: 'null'
          title: Chunks Below
        full_doc:
          type: boolean
          title: Full Doc
          default: false
        run_search:
          $ref: '#/components/schemas/OptionalSearchSetting'
          default: auto
        real_time:
          type: boolean
          title: Real Time
          default: true
        filters:
          anyOf:
            - $ref: '#/components/schemas/BaseFilters'
            - type: 'null'
        enable_auto_detect_filters:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Enable Auto Detect Filters
        offset:
          anyOf:
            - type: integer
            - type: 'null'
          title: Offset
        limit:
          anyOf:
            - type: integer
            - type: 'null'
          title: Limit
        dedupe_docs:
          type: boolean
          title: Dedupe Docs
          default: false
      type: object
      title: RetrievalDetails
    LLMEvaluationType:
      type: string
      enum:
        - agentic
        - basic
        - skip
        - unspecified
      title: LLMEvaluationType
    RerankingDetails:
      properties:
        rerank_model_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Rerank Model Name
        rerank_api_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Rerank Api Url
        rerank_provider_type:
          anyOf:
            - $ref: '#/components/schemas/RerankerProvider'
            - type: 'null'
        rerank_api_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Rerank Api Key
        num_rerank:
          type: integer
          title: Num Rerank
        disable_rerank_for_streaming:
          type: boolean
          title: Disable Rerank For Streaming
          default: false
      type: object
      required:
        - rerank_model_name
        - rerank_api_url
        - rerank_provider_type
        - num_rerank
      title: RerankingDetails
    SavedSearchDocWithContent:
      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
          default: 0
        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
        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
        db_doc_id:
          type: integer
          title: Db Doc Id
        content:
          type: string
          title: Content
      type: object
      required:
        - document_id
        - chunk_ind
        - semantic_identifier
        - blurb
        - source_type
        - boost
        - hidden
        - metadata
        - match_highlights
        - db_doc_id
        - content
      title: SavedSearchDocWithContent
      description: >-
        Used for endpoints that need to return the actual contents of the
        retrieved

        section in addition to the match_highlights.
    DocumentSearchPagination:
      properties:
        offset:
          type: integer
          title: Offset
        limit:
          type: integer
          title: Limit
        returned_count:
          type: integer
          title: Returned Count
        has_more:
          type: boolean
          title: Has More
        next_offset:
          anyOf:
            - type: integer
            - type: 'null'
          title: Next Offset
      type: object
      required:
        - offset
        - limit
        - returned_count
        - has_more
      title: DocumentSearchPagination
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    OptionalSearchSetting:
      type: string
      enum:
        - always
        - never
        - auto
      title: OptionalSearchSetting
    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
        time_cutoff:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Time Cutoff
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/Tag'
              type: array
            - type: 'null'
          title: Tags
      type: object
      title: BaseFilters
    RerankerProvider:
      type: string
      enum:
        - cohere
        - litellm
        - bedrock
      title: RerankerProvider
    DocumentSource:
      type: string
      enum:
        - ingestion_api
        - slack
        - web
        - google_drive
        - gmail
        - requesttracker
        - github
        - gitbook
        - gitlab
        - guru
        - bookstack
        - outline
        - confluence
        - jira
        - slab
        - productboard
        - file
        - coda
        - notion
        - zulip
        - linear
        - hubspot
        - document360
        - gong
        - google_sites
        - zendesk
        - loopio
        - dropbox
        - sharepoint
        - teams
        - salesforce
        - discourse
        - axero
        - clickup
        - mediawiki
        - wikipedia
        - asana
        - s3
        - r2
        - google_cloud_storage
        - oci_storage
        - xenforo
        - not_applicable
        - discord
        - freshdesk
        - fireflies
        - egnyte
        - airtable
        - highspot
        - drupal_wiki
        - imap
        - bitbucket
        - testrail
        - mock_connector
        - user_file
      title: DocumentSource
    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

````