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

# Get Slow Queries

> Get slow queries and their filter patterns.

Identifies queries exceeding a latency threshold and shows which metadata
fields they're filtering on, helping pinpoint optimization opportunities.

**Use Cases:**
- Troubleshoot slow queries
- Identify unindexed fields causing slowdowns
- Debug performance issues
- Optimize query patterns

**Response Includes:**
- Query details (retriever, inputs, latency)
- Results count
- Metadata fields being filtered
- Full query context

**Example:**
```bash
curl -X GET "https://api.mixpeek.com/v1/analytics/namespaces/queries/slow?latency_threshold_ms=1000" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Namespace: your-namespace"
```



## OpenAPI

````yaml get /v1/analytics/namespaces/queries/slow
openapi: 3.1.0
info:
  title: Mixpeek API
  description: >-
    This is the Mixpeek API, providing access to various endpoints for data
    processing and retrieval.
  termsOfService: https://mixpeek.com/terms
  contact:
    name: Mixpeek Support
    url: https://mixpeek.com/contact
    email: info@mixpeek.com
  version: '0.82'
servers:
  - url: https://api.mixpeek.com
    description: Production
security: []
paths:
  /v1/analytics/namespaces/queries/slow:
    get:
      tags:
        - Analytics
        - Analytics - Namespaces
      summary: Get Slow Queries
      description: >-
        Get slow queries and their filter patterns.


        Identifies queries exceeding a latency threshold and shows which
        metadata

        fields they're filtering on, helping pinpoint optimization
        opportunities.


        **Use Cases:**

        - Troubleshoot slow queries

        - Identify unindexed fields causing slowdowns

        - Debug performance issues

        - Optimize query patterns


        **Response Includes:**

        - Query details (retriever, inputs, latency)

        - Results count

        - Metadata fields being filtered

        - Full query context


        **Example:**

        ```bash

        curl -X GET
        "https://api.mixpeek.com/v1/analytics/namespaces/queries/slow?latency_threshold_ms=1000"
        \
          -H "Authorization: Bearer YOUR_API_KEY" \
          -H "X-Namespace: your-namespace"
        ```
      operationId: get_slow_queries_v1_analytics_namespaces_queries_slow_get
      parameters:
        - name: days
          in: query
          required: false
          schema:
            type: integer
            maximum: 90
            minimum: 1
            description: Days of history to analyze
            default: 30
            title: Days
          description: Days of history to analyze
        - name: latency_threshold_ms
          in: query
          required: false
          schema:
            type: number
            maximum: 10000
            minimum: 100
            description: Latency threshold in ms
            default: 500
            title: Latency Threshold Ms
          description: Latency threshold in ms
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 500
            minimum: 1
            description: Maximum queries to return
            default: 100
            title: Limit
          description: Maximum queries to return
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SlowQueriesResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SlowQueriesResponse:
      properties:
        namespace_id:
          type: string
          title: Namespace Id
          description: Namespace ID analyzed
        time_range_days:
          type: integer
          title: Time Range Days
          description: Number of days analyzed
        latency_threshold_ms:
          type: number
          title: Latency Threshold Ms
          description: Latency threshold used
        slow_queries:
          items:
            $ref: '#/components/schemas/SlowQueryDetails'
          type: array
          title: Slow Queries
          description: Slow query details
        total_slow_queries:
          type: integer
          title: Total Slow Queries
          description: Total slow queries found
      type: object
      required:
        - namespace_id
        - time_range_days
        - latency_threshold_ms
        - slow_queries
        - total_slow_queries
      title: SlowQueriesResponse
      description: Response for slow queries endpoint.
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Always false for error responses
          default: false
        status:
          type: integer
          title: Status
          description: HTTP status code for this error
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: Error details payload
      type: object
      required:
        - status
        - error
      title: ErrorResponse
      description: Error response model.
      examples:
        - error:
            details:
              id: ns_123
              resource: namespace
            message: Namespace not found
            type: NotFoundError
          status: 404
          success: false
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SlowQueryDetails:
      properties:
        retriever_id:
          type: string
          title: Retriever Id
          description: Retriever that executed the query
        query:
          type: string
          title: Query
          description: Query input string
        latency_ms:
          type: number
          title: Latency Ms
          description: Query latency in milliseconds
        results_count:
          type: integer
          title: Results Count
          description: Number of results returned
        queried_fields:
          items:
            type: string
          type: array
          title: Queried Fields
          description: List of metadata fields queried
      type: object
      required:
        - retriever_id
        - query
        - latency_ms
        - results_count
        - queried_fields
      title: SlowQueryDetails
      description: Details of a slow query.
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Stable error type identifier (machine-readable)
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            Fine-grained error code for programmatic handling (e.g.,
            namespace_name_taken, feature_extractor_not_found). Present only
            when consumers may need to branch on a specific error condition.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Optional structured details to help debugging (validation errors,
            IDs, etc.)
      type: object
      required:
        - message
        - type
      title: ErrorDetail
      description: Error detail model.
    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

````