> ## Documentation Index
> Fetch the complete documentation index at: https://microstrate-1133-notifications-prefs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Search an index

> Performs a search on an index



## OpenAPI

````yaml /api-reference/endpoint/storage/openapi.json get /storage/search/{index}
openapi: 3.0.3
info:
  title: quiva.ai Gateway
  description: >-
    A comprehensive interface for managing key-value stores, object stores,
    streams, and search indexing
  contact:
    name: quiva.ai Support
    url: https://quiva.ai/help-center/
  version: 1.0.0
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearerAuth: []
  - apiKeyAuth: []
paths:
  /storage/search/{index}:
    get:
      tags:
        - Search
      summary: Search an index
      description: Performs a search on an index
      operationId: searchIndex
      parameters:
        - name: index
          in: path
          description: Name of the index to search
          required: true
          schema:
            type: string
          examples:
            users:
              summary: Users index
              value: users-index
            products:
              summary: Products index
              value: products-index
        - name: field
          in: query
          description: Field to search in
          required: true
          schema:
            type: string
          examples:
            name:
              summary: Search by name
              value: name
            email:
              summary: Search by email
              value: email
            description:
              summary: Search by description
              value: description
        - name: search
          in: query
          description: Search term
          required: true
          schema:
            type: string
          examples:
            name_search:
              summary: Search for name
              value: John
            partial_search:
              summary: Partial term search
              value: acme
        - name: search_type
          in: query
          description: Type of search to perform
          required: false
          schema:
            type: string
            enum:
              - exact
              - fuzzy
              - prefix
              - range
          examples:
            exact:
              summary: Exact match
              value: exact
            fuzzy:
              summary: Fuzzy match (typo-tolerant)
              value: fuzzy
            prefix:
              summary: Prefix match
              value: prefix
        - name: min
          in: query
          description: Minimum value for range searches
          required: false
          schema:
            type: number
          examples:
            age_min:
              summary: Minimum age
              value: 18
            price_min:
              summary: Minimum price
              value: 9.99
        - name: max
          in: query
          description: Maximum value for range searches
          required: false
          schema:
            type: number
          examples:
            age_max:
              summary: Maximum age
              value: 65
            price_max:
              summary: Maximum price
              value: 99.99
        - name: limit
          in: query
          description: Maximum number of results to return
          required: false
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 1000
          examples:
            small:
              summary: Small result set
              value: 5
            medium:
              summary: Medium result set
              value: 25
            large:
              summary: Large result set
              value: 100
        - name: sortBy
          in: query
          description: Field to sort results by
          required: false
          schema:
            type: string
          examples:
            by_name:
              summary: Sort by name
              value: name
            by_date:
              summary: Sort by date
              value: created_at
            by_score:
              summary: Sort by relevance score
              value: _score
      responses:
        '200':
          description: Search results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndexSearchResponse'
              examples:
                user_search:
                  summary: User search results
                  value:
                    body:
                      results:
                        - id: usr_abc123
                          stream: user-events
                          subject: users.profiles
                          fields:
                            name: John Doe
                            email: john.doe@example.com
                            age: 32
                            department: Engineering
                          score: 0.98
                          partition: 0
                          sequence: 1542
                          timestamp: 1710512400
                        - id: usr_def456
                          stream: user-events
                          subject: users.profiles
                          fields:
                            name: Johnny Smith
                            email: johnny.smith@example.com
                            age: 28
                            department: Marketing
                          score: 0.85
                          partition: 1
                          sequence: 2103
                          timestamp: 1710598800
                      results_total: 2
                    metadata:
                      field: name
                      search: John
                      index_name: users-index
                      index_duration: 5ms
                      index_hits: 2
                      index_partitions: 4
                range_search:
                  summary: Range search results
                  value:
                    body:
                      results:
                        - id: prod_001
                          fields:
                            name: Basic Widget
                            price: 19.99
                            category: widgets
                          score: 1
                          partition: 0
                          sequence: 501
                        - id: prod_002
                          fields:
                            name: Premium Widget
                            price: 49.99
                            category: widgets
                          score: 1
                          partition: 0
                          sequence: 502
                      results_total: 2
                    metadata:
                      field: price
                      search: range
                      index_name: products-index
                      index_duration: 3ms
                      index_hits: 2
                no_results:
                  summary: No matching results
                  value:
                    body:
                      results: []
                      results_total: 0
                    metadata:
                      field: name
                      search: nonexistent
                      index_name: users-index
                      index_duration: 1ms
                      index_hits: 0
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    IndexSearchResponse:
      type: object
      properties:
        body:
          type: object
          properties:
            results:
              type: array
              items:
                $ref: '#/components/schemas/IndexSearchItem'
            results_total:
              type: integer
        metadata:
          $ref: '#/components/schemas/Metadata'
    IndexSearchItem:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the result
        stream:
          type: string
        subject:
          type: string
        fields:
          type: object
          description: Indexed fields and their values
          additionalProperties: true
        score:
          type: number
          description: Relevance score of the result
        partition:
          type: integer
        sequence:
          type: integer
        timestamp:
          type: integer
    Metadata:
      type: object
      properties:
        bucket:
          type: string
          description: Bucket name
        duration:
          type: string
          description: Operation duration
        field:
          type: string
          description: Search field
        hits:
          type: integer
          description: Number of hits
        index_duration:
          type: string
          description: Index search duration
        index_hits:
          type: integer
          description: Number of index hits
        index_name:
          type: string
          description: Index name
        index_partitions:
          type: integer
          description: Number of index partitions
        key:
          type: string
          description: Entry key
        limit:
          type: integer
          description: Query limit
        partitions:
          type: integer
          description: Number of partitions
        search:
          type: string
          description: Search term
        stream:
          type: string
          description: Stream name
        subject:
          type: string
          description: Subject pattern
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message
  responses:
    BadRequestError:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: validation_error
    UnauthorizedError:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: unauthorized
    NotFoundError:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: not_found
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: internal_error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

````