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

# Search Records

> Search records within a collection.



## OpenAPI

````yaml POST /v2
openapi: 3.0.1
info:
  title: OpenAPI Sparq API
  description: >-
    This API provides access to Sparq, a sample store used to demonstrate
    features of the OpenAPI specification.
  license:
    name: MIT License
  version: 1.0.0
servers:
  - url: https://api.sparq.ai/v2
security:
  - bearerAuth: []
paths:
  /v2:
    servers:
      - url: https://{appUniqueId}.fast.sparq.ai
    post:
      description: Search records within a collection.
      parameters:
        - name: appUniqueId
          in: path
          description: Unique identifier for the application.
          required: true
          schema:
            type: string
      requestBody:
        description: Data for searching records within the collection.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequestBody'
        required: true
      responses:
        '200':
          description: Successful search response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
                type: object
        '401':
          description: Unauthorized. Authentication is required to access the resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SearchRequestBody:
      type: object
      properties:
        query:
          type: string
          description: The search query string.
        fields:
          type: array
          description: Fields to be returned in the search results.
        textFacets:
          type: array
          description: >-
            Text-based facets to be included in the search results for filtering
            and categorization.
        searchFields:
          type: array
          description: Fields to be searched against for the given query.
        filter:
          type: string
          description: Additional filtering criteria for the search.
        sort:
          type: array
          description: Sorting criteria for the search results.
        skip:
          type: integer
          description: Number of results to skip.
          default: 0
        count:
          type: integer
          description: Number of results to return.
        collection:
          type: string
          description: The collection or dataset to search within.
        facetCount:
          type: integer
          description: Maximum number of facet values to return for each facet.
        groupCount:
          type: integer
          description: Number of groups to return for grouping results.
        typoTolerance:
          type: integer
          description: Level of tolerance for typos in the search query.
        textFacetFilters:
          type: object
          description: Filters to be applied to text-based facets.
        numericFacets:
          type: object
          description: >-
            Numeric-based facets to be included in the search results for
            filtering and categorization.
        numericFacetFilters:
          type: object
          description: Filters to be applied to numeric-based facets.
        groupBy:
          type: string
          description: Field for grouping search results.
    SearchResponse:
      type: object
      properties:
        query:
          type: object
          description: The request query sent to the server.
        results:
          type: array
          description: The response sent from the server matching the search query.
        textFacets:
          type: array
          description: Text-based facets response received after the search.
        numericFacets:
          type: array
          description: Numeric-based facets response received after the search.
        responseTime:
          type: integer
          description: Response time taken by the server to send the response.
        totalHits:
          type: integer
          description: Number of results fulfilling the search criteria.
    Error:
      type: object
      properties:
        status:
          type: integer
          description: Status code indicating the error.
        data:
          type: string
          description: Additional information about the error.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````