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

# Get adminobservabilitytable query opsanalyze

> Analyze saved view query shapes and validate Table Query Ops index candidates

Required token scopes: `instance|read`



## OpenAPI

````yaml /swagger.json get /admin/observability/table-query-ops/analyze
openapi: 3.0.0
info:
  version: 1.0.0
  title: Teable App
  description: Manage Data as easy as drink a cup of tea
  x-logo:
    backgroundColor: '#F0F0F0'
    altText: Teable logo
servers:
  - url: https://app.teable.ai/api
security: []
tags:
  - name: base
    x-group: project
  - name: base node
    x-group: project node
  - name: base-share
    x-group: project-share
paths:
  /admin/observability/table-query-ops/analyze:
    get:
      tags:
        - admin
        - observability
      description: >-
        Analyze saved view query shapes and validate Table Query Ops index
        candidates


        Required token scopes: `instance|read`
      parameters:
        - schema:
            type: string
            minLength: 1
          required: false
          name: spaceId
          in: query
        - schema:
            type: string
            minLength: 1
          required: false
          name: baseId
          in: query
        - schema:
            type: string
            minLength: 1
          required: false
          name: tableId
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 50
          required: false
          name: maxIndexes
          in: query
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  scope:
                    type: object
                    properties:
                      spaceId:
                        type: string
                      baseId:
                        type: string
                      tableId:
                        type: string
                      maxIndexes:
                        type: number
                    required:
                      - maxIndexes
                  scannedViewCount:
                    type: number
                  parsedViewCount:
                    type: number
                  scannedRelationFieldCount:
                    type: number
                  candidateIndexCount:
                    type: number
                  validatedRecommendationCount:
                    type: number
                  rejectedCandidateCount:
                    type: number
                  skippedViewCount:
                    type: number
                  recommendedIndexSet:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: string
                        indexKind:
                          type: string
                        accessPath:
                          type: string
                        sourceKind:
                          type: string
                          enum:
                            - direct_field
                            - formula_result
                            - formula_source
                            - formula_expression
                        formulaEvidence:
                          type: object
                          properties:
                            formulaFieldId:
                              type: string
                            referencedFieldIds:
                              type: array
                              items:
                                type: string
                            functionNames:
                              type: array
                              items:
                                type: string
                            sourceKind:
                              type: string
                              enum:
                                - formula_result
                                - formula_source
                                - formula_expression
                            skippedReasons:
                              type: array
                              items:
                                type: string
                            expressionIndexable:
                              type: boolean
                            expressionIndexSkippedReasons:
                              type: array
                              items:
                                type: string
                            predicatePushdown:
                              type: object
                              properties:
                                supported:
                                  type: boolean
                                operatorFamilies:
                                  type: array
                                  items:
                                    type: string
                                sourceFunctionNames:
                                  type: array
                                  items:
                                    type: string
                                skippedReasons:
                                  type: array
                                  items:
                                    type: string
                              required:
                                - supported
                                - operatorFamilies
                                - sourceFunctionNames
                                - skippedReasons
                          required:
                            - referencedFieldIds
                            - functionNames
                            - skippedReasons
                        fields:
                          type: array
                          items:
                            type: string
                        optimizedSources:
                          type: array
                          items:
                            type: string
                        optimizedQueryShapes:
                          type: array
                          items:
                            type: string
                        explainStatus:
                          type: string
                          enum:
                            - validated
                            - skipped
                            - failed
                        explainMethod:
                          type: string
                          enum:
                            - explain
                            - hypothetical_index
                        explainReason:
                          type: string
                        explainCostBefore:
                          type: number
                        explainCostAfter:
                          type: number
                        explainCostDeltaPct:
                          type: number
                        explainPlanNodeBefore:
                          type: string
                        explainPlanNodeAfter:
                          type: string
                        explainUsesCandidateIndex:
                          type: boolean
                        confidence:
                          type: string
                        nextAction:
                          type: string
                          enum:
                            - ready_for_confirmation
                            - no_index_change
                            - candidate_not_recommended
                            - needs_plan_validation
                            - manual_investigation
                        hypotheticalIndexStatement:
                          type: string
                      required:
                        - index
                        - indexKind
                        - accessPath
                        - fields
                        - optimizedSources
                        - optimizedQueryShapes
                        - explainStatus
                        - confidence
                        - nextAction
                  rejectedCandidates:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: string
                        indexKind:
                          type: string
                        accessPath:
                          type: string
                        sourceKind:
                          type: string
                          enum:
                            - direct_field
                            - formula_result
                            - formula_source
                            - formula_expression
                        formulaEvidence:
                          type: object
                          properties:
                            formulaFieldId:
                              type: string
                            referencedFieldIds:
                              type: array
                              items:
                                type: string
                            functionNames:
                              type: array
                              items:
                                type: string
                            sourceKind:
                              type: string
                              enum:
                                - formula_result
                                - formula_source
                                - formula_expression
                            skippedReasons:
                              type: array
                              items:
                                type: string
                            expressionIndexable:
                              type: boolean
                            expressionIndexSkippedReasons:
                              type: array
                              items:
                                type: string
                            predicatePushdown:
                              type: object
                              properties:
                                supported:
                                  type: boolean
                                operatorFamilies:
                                  type: array
                                  items:
                                    type: string
                                sourceFunctionNames:
                                  type: array
                                  items:
                                    type: string
                                skippedReasons:
                                  type: array
                                  items:
                                    type: string
                              required:
                                - supported
                                - operatorFamilies
                                - sourceFunctionNames
                                - skippedReasons
                          required:
                            - referencedFieldIds
                            - functionNames
                            - skippedReasons
                        fields:
                          type: array
                          items:
                            type: string
                        optimizedSources:
                          type: array
                          items:
                            type: string
                        optimizedQueryShapes:
                          type: array
                          items:
                            type: string
                        explainStatus:
                          type: string
                          enum:
                            - validated
                            - skipped
                            - failed
                        explainMethod:
                          type: string
                          enum:
                            - explain
                            - hypothetical_index
                        explainReason:
                          type: string
                        explainCostBefore:
                          type: number
                        explainCostAfter:
                          type: number
                        explainCostDeltaPct:
                          type: number
                        explainPlanNodeBefore:
                          type: string
                        explainPlanNodeAfter:
                          type: string
                        explainUsesCandidateIndex:
                          type: boolean
                        confidence:
                          type: string
                        nextAction:
                          type: string
                          enum:
                            - ready_for_confirmation
                            - no_index_change
                            - candidate_not_recommended
                            - needs_plan_validation
                            - manual_investigation
                        hypotheticalIndexStatement:
                          type: string
                      required:
                        - index
                        - indexKind
                        - accessPath
                        - fields
                        - optimizedSources
                        - optimizedQueryShapes
                        - explainStatus
                        - confidence
                        - nextAction
                  coverageReport:
                    type: object
                    properties:
                      scannedSourceCount:
                        type: number
                      parsedSourceCount:
                        type: number
                      shapeCreatedSourceCount:
                        type: number
                      candidateGeneratedSourceCount:
                        type: number
                      explainValidatedSourceCount:
                        type: number
                      rejectedSourceCount:
                        type: number
                      skippedSourceCount:
                        type: number
                      skippedReasons:
                        type: object
                        additionalProperties:
                          type: number
                      formulaFields:
                        type: array
                        items:
                          type: object
                          properties:
                            formulaFieldId:
                              type: string
                            referencedFieldIds:
                              type: array
                              items:
                                type: string
                            functionNames:
                              type: array
                              items:
                                type: string
                            sourceKind:
                              type: string
                              enum:
                                - formula_result
                                - formula_source
                                - formula_expression
                            skippedReasons:
                              type: array
                              items:
                                type: string
                            expressionIndexable:
                              type: boolean
                            expressionIndexSkippedReasons:
                              type: array
                              items:
                                type: string
                            predicatePushdown:
                              type: object
                              properties:
                                supported:
                                  type: boolean
                                operatorFamilies:
                                  type: array
                                  items:
                                    type: string
                                sourceFunctionNames:
                                  type: array
                                  items:
                                    type: string
                                skippedReasons:
                                  type: array
                                  items:
                                    type: string
                              required:
                                - supported
                                - operatorFamilies
                                - sourceFunctionNames
                                - skippedReasons
                          required:
                            - referencedFieldIds
                            - functionNames
                            - skippedReasons
                      scannedFormulaFieldCount:
                        type: number
                      validatedFormulaFieldCount:
                        type: number
                      rejectedFormulaFieldCount:
                        type: number
                      skippedFormulaFieldCount:
                        type: number
                      formulaSkippedReasons:
                        type: object
                        additionalProperties:
                          type: number
                      sources:
                        type: array
                        items:
                          type: object
                          properties:
                            sourceType:
                              type: string
                              enum:
                                - saved_view
                                - relation_field
                                - runtime_observation
                                - manual
                            sourceId:
                              type: string
                            tableId:
                              type: string
                            statuses:
                              type: array
                              items:
                                type: string
                                enum:
                                  - scanned
                                  - parsed
                                  - shape_created
                                  - candidate_generated
                                  - explain_validated
                                  - rejected
                                  - skipped
                            shapeHash:
                              type: string
                            queryKind:
                              type: string
                            candidateIndexKeys:
                              type: array
                              items:
                                type: string
                            recommendedIndexKeys:
                              type: array
                              items:
                                type: string
                            rejectedIndexKeys:
                              type: array
                              items:
                                type: string
                            skippedReason:
                              type: string
                            error:
                              type: string
                          required:
                            - sourceType
                            - sourceId
                            - tableId
                            - statuses
                            - candidateIndexKeys
                            - recommendedIndexKeys
                            - rejectedIndexKeys
                    required:
                      - scannedSourceCount
                      - parsedSourceCount
                      - shapeCreatedSourceCount
                      - candidateGeneratedSourceCount
                      - explainValidatedSourceCount
                      - rejectedSourceCount
                      - skippedSourceCount
                      - skippedReasons
                      - formulaFields
                      - scannedFormulaFieldCount
                      - validatedFormulaFieldCount
                      - rejectedFormulaFieldCount
                      - skippedFormulaFieldCount
                      - formulaSkippedReasons
                      - sources
                  queryRiskReports:
                    type: array
                    items:
                      type: object
                      properties:
                        sourceType:
                          type: string
                          enum:
                            - saved_view
                            - relation_field
                            - runtime_observation
                            - manual
                        sourceId:
                          type: string
                        sourceName:
                          type: string
                        tableId:
                          type: string
                        queryKind:
                          type: string
                        shapeHash:
                          type: string
                        riskLevel:
                          type: string
                          enum:
                            - none
                            - low
                            - medium
                            - high
                            - critical
                        riskScore:
                          type: number
                        reasonCodes:
                          type: array
                          items:
                            type: string
                        shapeSummary:
                          type: object
                          properties:
                            filterFields:
                              type: array
                              items:
                                type: object
                                properties:
                                  fieldId:
                                    type: string
                                  operatorFamily:
                                    type: string
                                  sourceKind:
                                    type: string
                                required:
                                  - fieldId
                                  - operatorFamily
                            sortFields:
                              type: array
                              items:
                                type: object
                                properties:
                                  fieldId:
                                    type: string
                                  systemColumn:
                                    type: string
                                  direction:
                                    type: string
                                    enum:
                                      - asc
                                      - desc
                                  source:
                                    type: string
                                required:
                                  - direction
                                  - source
                            search:
                              type: object
                              properties:
                                fieldCount:
                                  type: number
                                allFields:
                                  type: boolean
                                valueLengthBucket:
                                  type: string
                              required:
                                - fieldCount
                                - allFields
                                - valueLengthBucket
                            aggregation:
                              type: object
                              properties:
                                groupFieldCount:
                                  type: number
                                metricCount:
                                  type: number
                                hasFilter:
                                  type: boolean
                              required:
                                - groupFieldCount
                                - metricCount
                                - hasFilter
                            relation:
                              type: object
                              properties:
                                relationKind:
                                  type: string
                                sourceTableId:
                                  type: string
                                targetTableId:
                                  type: string
                                fieldReferenceCount:
                                  type: number
                                hasTargetFilter:
                                  type: boolean
                                hasTargetSort:
                                  type: boolean
                              required:
                                - relationKind
                                - sourceTableId
                                - targetTableId
                                - fieldReferenceCount
                                - hasTargetFilter
                                - hasTargetSort
                            formulaFields:
                              type: array
                              items:
                                type: object
                                properties:
                                  formulaFieldId:
                                    type: string
                                  referencedFieldIds:
                                    type: array
                                    items:
                                      type: string
                                  functionNames:
                                    type: array
                                    items:
                                      type: string
                                  sourceKind:
                                    type: string
                                    enum:
                                      - formula_result
                                      - formula_source
                                      - formula_expression
                                  skippedReasons:
                                    type: array
                                    items:
                                      type: string
                                  expressionIndexable:
                                    type: boolean
                                  expressionIndexSkippedReasons:
                                    type: array
                                    items:
                                      type: string
                                  predicatePushdown:
                                    type: object
                                    properties:
                                      supported:
                                        type: boolean
                                      operatorFamilies:
                                        type: array
                                        items:
                                          type: string
                                      sourceFunctionNames:
                                        type: array
                                        items:
                                          type: string
                                      skippedReasons:
                                        type: array
                                        items:
                                          type: string
                                    required:
                                      - supported
                                      - operatorFamilies
                                      - sourceFunctionNames
                                      - skippedReasons
                                required:
                                  - referencedFieldIds
                                  - functionNames
                                  - skippedReasons
                          required:
                            - filterFields
                            - sortFields
                            - formulaFields
                        physicalStats:
                          type: object
                          properties:
                            estimatedRows:
                              type: number
                              nullable: true
                          required:
                            - estimatedRows
                        indexInventory:
                          type: object
                          properties:
                            state:
                              type: string
                            existingIndexStructures:
                              type: array
                              items:
                                type: string
                            candidateIndexStructures:
                              type: array
                              items:
                                type: string
                            abnormalIndexes:
                              type: array
                              items:
                                type: string
                          required:
                            - state
                            - existingIndexStructures
                            - candidateIndexStructures
                            - abnormalIndexes
                        planEvidence:
                          type: object
                          properties:
                            explainStatus:
                              type: string
                              enum:
                                - validated
                                - skipped
                                - failed
                            explainMethod:
                              type: string
                              enum:
                                - explain
                                - hypothetical_index
                            explainReason:
                              type: string
                            costBefore:
                              type: number
                            costAfter:
                              type: number
                            costDeltaPct:
                              type: number
                            planNodeBefore:
                              type: string
                            planNodeAfter:
                              type: string
                            usesCandidateIndex:
                              type: boolean
                          required:
                            - explainStatus
                        remediationSummary:
                          type: object
                          properties:
                            hasIndexRecommendation:
                              type: boolean
                            recommendedIndexKeys:
                              type: array
                              items:
                                type: string
                            rejectedIndexKeys:
                              type: array
                              items:
                                type: string
                            nextAction:
                              type: string
                              enum:
                                - ready_for_confirmation
                                - no_index_change
                                - candidate_not_recommended
                                - needs_plan_validation
                                - manual_investigation
                          required:
                            - hasIndexRecommendation
                            - recommendedIndexKeys
                            - rejectedIndexKeys
                            - nextAction
                      required:
                        - sourceType
                        - sourceId
                        - tableId
                        - queryKind
                        - shapeHash
                        - riskLevel
                        - riskScore
                        - reasonCodes
                        - shapeSummary
                        - physicalStats
                        - indexInventory
                        - remediationSummary
                  rows:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: string
                        indexKind:
                          type: string
                        accessPath:
                          type: string
                        sourceKind:
                          type: string
                          enum:
                            - direct_field
                            - formula_result
                            - formula_source
                            - formula_expression
                        formulaEvidence:
                          type: object
                          properties:
                            formulaFieldId:
                              type: string
                            referencedFieldIds:
                              type: array
                              items:
                                type: string
                            functionNames:
                              type: array
                              items:
                                type: string
                            sourceKind:
                              type: string
                              enum:
                                - formula_result
                                - formula_source
                                - formula_expression
                            skippedReasons:
                              type: array
                              items:
                                type: string
                            expressionIndexable:
                              type: boolean
                            expressionIndexSkippedReasons:
                              type: array
                              items:
                                type: string
                            predicatePushdown:
                              type: object
                              properties:
                                supported:
                                  type: boolean
                                operatorFamilies:
                                  type: array
                                  items:
                                    type: string
                                sourceFunctionNames:
                                  type: array
                                  items:
                                    type: string
                                skippedReasons:
                                  type: array
                                  items:
                                    type: string
                              required:
                                - supported
                                - operatorFamilies
                                - sourceFunctionNames
                                - skippedReasons
                          required:
                            - referencedFieldIds
                            - functionNames
                            - skippedReasons
                        fields:
                          type: array
                          items:
                            type: string
                        optimizedSources:
                          type: array
                          items:
                            type: string
                        optimizedQueryShapes:
                          type: array
                          items:
                            type: string
                        explainStatus:
                          type: string
                          enum:
                            - validated
                            - skipped
                            - failed
                        explainMethod:
                          type: string
                          enum:
                            - explain
                            - hypothetical_index
                        explainReason:
                          type: string
                        explainCostBefore:
                          type: number
                        explainCostAfter:
                          type: number
                        explainCostDeltaPct:
                          type: number
                        explainPlanNodeBefore:
                          type: string
                        explainPlanNodeAfter:
                          type: string
                        explainUsesCandidateIndex:
                          type: boolean
                        confidence:
                          type: string
                        nextAction:
                          type: string
                          enum:
                            - ready_for_confirmation
                            - no_index_change
                            - candidate_not_recommended
                            - needs_plan_validation
                            - manual_investigation
                        hypotheticalIndexStatement:
                          type: string
                      required:
                        - index
                        - indexKind
                        - accessPath
                        - fields
                        - optimizedSources
                        - optimizedQueryShapes
                        - explainStatus
                        - confidence
                        - nextAction
                required:
                  - scope
                  - scannedViewCount
                  - parsedViewCount
                  - scannedRelationFieldCount
                  - candidateIndexCount
                  - validatedRecommendationCount
                  - rejectedCandidateCount
                  - skippedViewCount
                  - recommendedIndexSet
                  - rejectedCandidates
                  - coverageReport
                  - queryRiskReports
                  - rows
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          source: |-
            curl --request GET \
              --url 'https://app.teable.ai/api/admin/observability/table-query-ops/analyze?spaceId=SOME_STRING_VALUE&baseId=SOME_STRING_VALUE&tableId=SOME_STRING_VALUE&maxIndexes=SOME_INTEGER_VALUE' \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
        - lang: JavaScript
          source: >-
            const url =
            'https://app.teable.ai/api/admin/observability/table-query-ops/analyze?spaceId=SOME_STRING_VALUE&baseId=SOME_STRING_VALUE&tableId=SOME_STRING_VALUE&maxIndexes=SOME_INTEGER_VALUE';

            const options = {method: 'GET', headers: {Authorization: 'Bearer
            REPLACE_BEARER_TOKEN'}};


            try {
              const response = await fetch(url, options);
              const data = await response.json();
              console.log(data);
            } catch (error) {
              console.error(error);
            }
        - lang: Node.js
          source: |-
            const http = require('https');

            const options = {
              method: 'GET',
              hostname: 'app.teable.ai',
              port: null,
              path: '/api/admin/observability/table-query-ops/analyze?spaceId=SOME_STRING_VALUE&baseId=SOME_STRING_VALUE&tableId=SOME_STRING_VALUE&maxIndexes=SOME_INTEGER_VALUE',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN'
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on('data', function (chunk) {
                chunks.push(chunk);
              });

              res.on('end', function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.end();
        - lang: Python
          source: >-
            import http.client


            conn = http.client.HTTPSConnection("app.teable.ai")


            headers = { 'Authorization': "Bearer REPLACE_BEARER_TOKEN" }


            conn.request("GET",
            "/api/admin/observability/table-query-ops/analyze?spaceId=SOME_STRING_VALUE&baseId=SOME_STRING_VALUE&tableId=SOME_STRING_VALUE&maxIndexes=SOME_INTEGER_VALUE",
            headers=headers)


            res = conn.getresponse()

            data = res.read()


            print(data.decode("utf-8"))
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````