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

# Search resources of a specific collection in the data partition

> Search resources of a specific collection in the data partition.




## OpenAPI

````yaml /api-reference/datapartition.yml post /partitions/{partitionKey}/v1/collections/{collectionKey}/query
openapi: 3.0.1
info:
  title: Data Partition API
  version: 1.0.0
servers:
  - url: https://api.{workspaceId}.clinia.cloud
    variables:
      workspaceId:
        default: ''
        description: The workspace id.
security:
  - apiKey: []
  - basicHttpAuth: []
  - bearerHttpAuth: []
tags:
  - name: Browse
    description: Browse resources or relationships in a data partition.
  - name: Resources
    description: Consumption of resources in a data partition.
  - name: Search
    description: Search for resources in a data partition.
paths:
  /partitions/{partitionKey}/v1/collections/{collectionKey}/query:
    post:
      tags:
        - Search
      summary: Search resources of a specific collection in the data partition
      description: |
        Search resources of a specific collection in the data partition.
      operationId: Query
      parameters:
        - name: partitionKey
          in: path
          description: The partition from which to execute the query.
          required: true
          schema:
            type: string
        - name: collectionKey
          in: path
          description: The collection from which to execute the query.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v1SearchParameters'
        required: true
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1QueryResponse'
        '400':
          description: Returned when the request is malformed or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1Error'
        '404':
          description: Returned when the resource type does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1Error'
        '413':
          $ref: '#/components/responses/v1PayloadTooLargeError'
        '429':
          $ref: '#/components/responses/v1TooManyRequestError'
        '504':
          $ref: '#/components/responses/v1GatewayTimeoutError'
components:
  schemas:
    v1SearchParameters:
      type: object
      description: >
        Use dot-notation paths (e.g., `name`, `meta.updatedAt`, `address.city`).

        To include properties from relationships or adjacent records, request
        them via `traversedProperties` and reference with `@` (e.g.,
        `@worksAt.*`, `@worksAt.@clinic.name`).

        Some endpoints require federated paths such as
        `resources.<collectionKey>.<propertyKey>` or
        `relationships.<collectionKey>.<propertyKey>`.
      properties:
        semanticQuery:
          $ref: '#/components/schemas/v1SemanticQuery'
        query:
          $ref: '#/components/schemas/v1Operator'
          description: >-
            An operator that will be used to search the targeted collections.
            The matching operator will count as part of the ranking.
        filter:
          $ref: '#/components/schemas/v1Operator'
          description: >-
            An operator that will be used to filter the targeted collections.
            The filtering operator excludes results that do not match the
            specified criteria.
        properties:
          $ref: '#/components/schemas/v1PropertiesSelector'
        highlighting:
          type: array
          items:
            type: string
        page:
          type: integer
          format: int32
        perPage:
          type: integer
          format: int32
          default: 20
        sort:
          $ref: '#/components/schemas/v1Sort'
        aggregations:
          type: array
          items:
            $ref: '#/components/schemas/v1Aggregation'
        traversedProperties:
          type: array
          items:
            type: string
          description: >
            The properties from the relationships or adjacent records that will
            be returned in the search response.

            The wildcard '*' can be used in itself or in combination with a
            prefix
              - `*` will return all traversed properties.
              - `@worksAt.*` will return all traversed properties from the relationship 'worksAt'.
              - `@worksAt.@clinic.*` will return all traversed properties from an adjacent 'clinic' connected with a 'worksAt' relationship.
      additionalProperties: false
    v1QueryResponse:
      required:
        - hits
        - meta
        - aggregates
      type: object
      additionalProperties: false
      properties:
        semanticQueryInfo:
          $ref: '#/components/schemas/v1SemanticQueryInfo'
        hits:
          type: array
          items:
            $ref: '#/components/schemas/v1Hit'
        meta:
          $ref: '#/components/schemas/v1QueryResponseMeta'
        aggregates:
          type: array
          items:
            $ref: '#/components/schemas/v1Aggregate'
    v1Error:
      type: object
      required:
        - code
        - message
        - type
      properties:
        code:
          $ref: '#/components/schemas/v1ErrorCode'
        message:
          type: string
        type:
          $ref: '#/components/schemas/v1ErrorType'
        details:
          description: list of errors that occurred if applicable.
          type: array
          items:
            $ref: '#/components/schemas/v1Error'
        additionalContext:
          type: object
          additionalProperties: true
    v1SemanticQuery:
      type: object
      additionalProperties: false
      description: >
        A semantic query is a high-level representation of the user's intent.

        When specified, it will trigger our query understanding capabilities and
        generate a query and filter operator that will be applied to the search
        parameters.
      required:
        - value
      properties:
        value:
          type: string
          description: The text value of the semantic query.
        paths:
          $ref: '#/components/schemas/v1PropertiesSelector'
          description: >
            Limits the semantic paths the LLM can consider. Accepts
            collection-scoped paths or federated paths depending on the
            endpoint.
    v1Operator:
      description: >
        Logical (`and`, `or`, `not`, `all`, `any`),

        composite (`composite`),

        comparisons (`eq`, `gt`, `lt`),

        text match (`match` with types `phrase`, `phrasePrefix`, `word`,
        `wordPrefix` and optional `fuzziness` up to 3),

        geo (`geoDistance`), and vector (`knn`).
      oneOf:
        - $ref: '#/components/schemas/v1AndOperator'
        - $ref: '#/components/schemas/v1OrOperator'
        - $ref: '#/components/schemas/v1AllOperator'
        - $ref: '#/components/schemas/v1AnyOperator'
        - $ref: '#/components/schemas/v1CompositeOperator'
        - $ref: '#/components/schemas/v1EqOperator'
        - $ref: '#/components/schemas/V1KNNOperator'
        - $ref: '#/components/schemas/v1GeoDistanceOperator'
        - $ref: '#/components/schemas/v1GreaterThanOperator'
        - $ref: '#/components/schemas/v1LessThanOperator'
        - $ref: '#/components/schemas/v1MatchOperator'
        - $ref: '#/components/schemas/v1NotOperator'
    v1PropertiesSelector:
      type: object
      description: >
        Properties selector allows to specify which properties should be
        included or excluded in the search response.

        System properties are always included and cannot be excluded.

        Exclude properties has precedence over include properties.
      properties:
        include:
          type: array
          items:
            type: string
          description: |
            The properties to include in the search response.
            System properties are included by default.
        exclude:
          type: array
          items:
            type: string
          description: |
            The properties to exclude from the search response.
            System properties are not allowed to be excluded.
      additionalProperties: false
    v1Sort:
      type: object
      required:
        - path
      properties:
        direction:
          $ref: '#/components/schemas/v1SortDirection'
        path:
          type: string
          description: >-
            Field to sort by. Use dot-notation or federated syntax as required
            by the endpoint.
    v1Aggregation:
      type: object
      oneOf:
        - $ref: '#/components/schemas/v1LexicalAggregation'
      discriminator:
        propertyName: type
        mapping:
          LEXICAL:
            $ref: '#/components/schemas/v1LexicalAggregation'
    v1SemanticQueryInfo:
      type: object
      required:
        - originalQuery
      additionalProperties: false
      properties:
        reasoning:
          type: string
          description: The reasoning behind the semantic query.
        originalQuery:
          type: string
          description: The original query text provided by the user.
        query:
          $ref: '#/components/schemas/v1Operator'
          description: The generated query operator based on the semantic query.
        filter:
          $ref: '#/components/schemas/v1Operator'
          description: The filter operator to be applied to the search parameters.
    v1Hit:
      type: object
      required:
        - hitType
        - resource
        - score
      properties:
        hitType:
          $ref: '#/components/schemas/v1HitType'
        score:
          type: number
          format: double
          description: >-
            The score of the hit in the search results, indicating its
            relevance.
        resource:
          type: object
          x-is-generic: true
        traversedProperties:
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/v1TraversedProperty'
        highlighting:
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/v1HighlightingHit'
    v1QueryResponseMeta:
      type: object
      required:
        - numPages
        - page
        - perPage
        - total
      properties:
        numPages:
          type: integer
          format: int32
        page:
          type: integer
          format: int32
        perPage:
          type: integer
          format: int32
        total:
          type: integer
          format: int32
        filter:
          $ref: '#/components/schemas/v1Operator'
    v1Aggregate:
      type: object
      oneOf:
        - $ref: '#/components/schemas/v1LexicalAggregate'
      discriminator:
        propertyName: type
        mapping:
          LEXICAL:
            $ref: '#/components/schemas/v1LexicalAggregate'
    v1ErrorCode:
      type: integer
      format: int32
      enum:
        - 400
        - 401
        - 403
        - 404
        - 408
        - 409
        - 413
        - 429
        - 500
        - 501
        - 504
    v1ErrorType:
      type: string
      enum:
        - ALREADY_EXISTS
        - FAILED_PRECONDITION
        - INTERNAL
        - INVALID_ARGUMENT
        - NOT_FOUND
        - OUT_OF_RANGE
        - UNIMPLEMENTED
        - PERMISSION_DENIED
        - UNAUTHENTICATED
        - CONTENT_TOO_LARGE
        - REQUEST_TIMEOUT
        - TOO_MANY_REQUEST
        - GATEWAY_TIMEOUT
    v1AndOperator:
      allOf:
        - $ref: '#/components/schemas/V1OperatorBase'
        - type: object
          required:
            - and
          properties:
            and:
              type: array
              items:
                $ref: '#/components/schemas/v1Operator'
    v1OrOperator:
      allOf:
        - $ref: '#/components/schemas/V1OperatorBase'
        - type: object
          required:
            - or
          properties:
            or:
              type: array
              items:
                $ref: '#/components/schemas/v1Operator'
    v1AllOperator:
      allOf:
        - $ref: '#/components/schemas/V1OperatorBase'
        - type: object
          required:
            - all
          properties:
            all:
              type: object
              minProperties: 1
              maxProperties: 1
              additionalProperties:
                $ref: '#/components/schemas/v1SupportedPrimitiveArrays'
    v1AnyOperator:
      allOf:
        - $ref: '#/components/schemas/V1OperatorBase'
        - type: object
          required:
            - any
          properties:
            any:
              type: object
              minProperties: 1
              maxProperties: 1
              additionalProperties:
                $ref: '#/components/schemas/v1SupportedPrimitiveArrays'
    v1CompositeOperator:
      allOf:
        - $ref: '#/components/schemas/V1OperatorBase'
        - type: object
          required:
            - composite
          properties:
            composite:
              type: object
              minProperties: 1
              maxProperties: 1
              additionalProperties:
                type: array
                items:
                  $ref: '#/components/schemas/v1Operator'
    v1EqOperator:
      allOf:
        - $ref: '#/components/schemas/V1OperatorBase'
        - type: object
          required:
            - eq
          properties:
            eq:
              type: object
              minProperties: 1
              maxProperties: 1
              additionalProperties:
                $ref: '#/components/schemas/v1EqCondition'
    V1KNNOperator:
      allOf:
        - $ref: '#/components/schemas/V1OperatorBase'
        - type: object
          required:
            - knn
          properties:
            knn:
              type: object
              minProperties: 1
              maxProperties: 1
              additionalProperties:
                $ref: '#/components/schemas/v1KNNCondition'
    v1GeoDistanceOperator:
      allOf:
        - $ref: '#/components/schemas/V1OperatorBase'
        - type: object
          required:
            - geoDistance
          properties:
            geoDistance:
              type: object
              minProperties: 1
              maxProperties: 1
              additionalProperties:
                $ref: '#/components/schemas/v1GeoDistanceCondition'
    v1GreaterThanOperator:
      allOf:
        - $ref: '#/components/schemas/V1OperatorBase'
        - type: object
          required:
            - gt
          properties:
            gt:
              type: object
              minProperties: 1
              maxProperties: 1
              additionalProperties:
                $ref: '#/components/schemas/v1SupportedComparablePrimitives'
    v1LessThanOperator:
      allOf:
        - $ref: '#/components/schemas/V1OperatorBase'
        - type: object
          required:
            - lt
          properties:
            lt:
              type: object
              minProperties: 1
              maxProperties: 1
              additionalProperties:
                $ref: '#/components/schemas/v1SupportedComparablePrimitives'
    v1MatchOperator:
      allOf:
        - $ref: '#/components/schemas/V1OperatorBase'
        - type: object
          required:
            - match
          properties:
            match:
              type: object
              minProperties: 1
              maxProperties: 1
              additionalProperties:
                $ref: '#/components/schemas/v1MatchCondition'
    v1NotOperator:
      allOf:
        - $ref: '#/components/schemas/V1OperatorBase'
        - type: object
          required:
            - not
          properties:
            not:
              $ref: '#/components/schemas/v1Operator'
    v1SortDirection:
      type: string
      default: DESC
      enum:
        - DESC
        - ASC
    v1LexicalAggregation:
      allOf:
        - $ref: '#/components/schemas/v1BaseAggregation'
        - type: object
          properties:
            prefix:
              type: string
              description: >-
                The prefix is an optional query to filter the values to
                aggregate (e.g. 'mont' would match 'montreal', 'Montecarlo',
                etc.).
            size:
              type: integer
              format: int32
              description: >-
                The maximum number of unique values to return in the
                aggregation.
              default: 20
    v1HitType:
      type: string
      enum:
        - RESOURCE
        - RELATIONSHIP
        - CONCEPT
        - PIPELINE_EXECUTION
        - RESOLUTION_QUEUED_ITEM
    v1TraversedProperty:
      required:
        - value
        - type
      type: object
      properties:
        type:
          $ref: '#/components/schemas/v1DataType'
        value:
          type: object
          x-is-generic: true
        relationshipId:
          type: string
        relationshipType:
          type: string
        recordId:
          type: string
        recordType:
          type: string
    v1HighlightingHit:
      type: object
      oneOf:
        - $ref: '#/components/schemas/v1HighlightingHitTextual'
        - $ref: '#/components/schemas/v1HighlightingHitVector'
      discriminator:
        propertyName: type
        mapping:
          textual:
            $ref: '#/components/schemas/v1HighlightingHitTextual'
          vector:
            $ref: '#/components/schemas/v1HighlightingHitVector'
    v1LexicalAggregate:
      allOf:
        - $ref: '#/components/schemas/v1BaseAggregation'
        - type: object
          required:
            - aggregate
          properties:
            aggregate:
              type: array
              items:
                $ref: '#/components/schemas/v1LexicalAggregateItem'
    V1OperatorBase:
      type: object
      properties:
        id:
          type: string
    v1SupportedPrimitiveArrays:
      oneOf:
        - $ref: '#/components/schemas/v1ArrayOfStrings'
        - $ref: '#/components/schemas/v1ArrayOfIntegers'
        - $ref: '#/components/schemas/v1ArrayOfDoubles'
    v1EqCondition:
      oneOf:
        - $ref: '#/components/schemas/v1SupportedPrimitives'
        - $ref: '#/components/schemas/v1EqObject'
    v1KNNCondition:
      type: object
      additionalProperties: false
      required:
        - value
      properties:
        value:
          type: string
    v1GeoDistanceCondition:
      type: object
      required:
        - coordinates
        - radius
      properties:
        coordinates:
          $ref: '#/components/schemas/v1GeoDistanceConditionCoordinates'
        radius:
          type: integer
          format: int32
      additionalProperties: false
    v1SupportedComparablePrimitives:
      oneOf:
        - $ref: '#/components/schemas/v1String'
        - $ref: '#/components/schemas/v1Integer'
        - $ref: '#/components/schemas/v1Double'
    v1MatchCondition:
      type: object
      description: The match condition is used to match a string field with a given value.
      additionalProperties: false
      required:
        - value
        - type
      properties:
        value:
          type: string
        type:
          $ref: '#/components/schemas/v1MatchOperatorType'
        fuzziness:
          type: integer
          format: int32
          maximum: 3
    v1BaseAggregation:
      type: object
      required:
        - type
        - path
      properties:
        type:
          $ref: '#/components/schemas/v1AggregationType'
        path:
          type: string
          description: The path of the property to aggregate.
    v1DataType:
      type: string
      enum:
        - address
        - attachment
        - boolean
        - code
        - coding
        - contactpoint
        - date
        - datetime
        - decimal
        - geopoint
        - humanname
        - identifier
        - instant
        - integer
        - markdown
        - period
        - reference
        - symbol
        - time
        - uri
        - url
        - xhtml
        - array
        - object
        - densevector
    v1HighlightingHitTextual:
      type: object
      required:
        - type
        - highlight
      properties:
        type:
          $ref: '#/components/schemas/v1HighlightingHitType'
        highlight:
          type: string
    v1HighlightingHitVector:
      type: object
      required:
        - type
        - score
        - path
        - data
      properties:
        type:
          $ref: '#/components/schemas/v1HighlightingHitType'
        score:
          type: number
        path:
          type: string
        data:
          type: string
    v1LexicalAggregateItem:
      type: object
      required:
        - value
        - count
      properties:
        value:
          type: string
        count:
          type: integer
          format: int64
    v1ArrayOfStrings:
      type: array
      items:
        type: string
    v1ArrayOfIntegers:
      type: array
      items:
        type: integer
        format: int32
    v1ArrayOfDoubles:
      type: array
      items:
        type: number
        format: double
    v1SupportedPrimitives:
      oneOf:
        - $ref: '#/components/schemas/v1String'
        - $ref: '#/components/schemas/v1Integer'
        - $ref: '#/components/schemas/v1Double'
        - $ref: '#/components/schemas/v1Bool'
    v1EqObject:
      type: object
      description: >
        The eq operator condition with an additional normalized field to support
        queries that require case-insensitive equality.

        Normalized equality is only supported for string values.
      additionalProperties: false
      required:
        - value
      properties:
        value:
          $ref: '#/components/schemas/v1SupportedPrimitives'
        normalized:
          type: boolean
    v1GeoDistanceConditionCoordinates:
      oneOf:
        - $ref: '#/components/schemas/v1GeoPoint'
        - $ref: '#/components/schemas/v1String'
    v1String:
      type: string
    v1Integer:
      pattern: ^[0]|[-+]?[1-9][0-9]*$
      type: integer
      description: A whole number.
      format: int32
    v1Double:
      type: number
      format: double
    v1MatchOperatorType:
      type: string
      enum:
        - phrase
        - phrasePrefix
        - word
        - wordPrefix
    v1AggregationType:
      type: string
      enum:
        - LEXICAL
    v1HighlightingHitType:
      type: string
      enum:
        - textual
        - vector
    v1Bool:
      type: boolean
    v1GeoPoint:
      type: object
      properties:
        latitude:
          $ref: '#/components/schemas/v1Decimal'
        longitude:
          $ref: '#/components/schemas/v1Decimal'
      additionalProperties: false
      required:
        - latitude
        - longitude
    v1Decimal:
      pattern: ^-?(0|[1-9][0-9]{0,17})(\.[0-9]{1,17})?([eE][+-]?[0-9]{1,9}})?$
      type: number
      format: double
      description: A rational number with implicit precision.
  responses:
    v1PayloadTooLargeError:
      description: Returned when the payload exceeds the max content size (100kB).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/v1Error'
    v1TooManyRequestError:
      description: Returned when the server starts throttling the requests.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/v1Error'
    v1GatewayTimeoutError:
      description: Returned when the request exceeds the server timeout window.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/v1Error'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-Clinia-API-Key
    basicHttpAuth:
      description: Basic HTTP authentication.
      type: http
      scheme: basic
    bearerHttpAuth:
      description: JWT Bearer authentication.
      type: http
      scheme: Bearer
      bearerFormat: JWT

````