paths:
  /collections:
    get:
      tags: 
        - Collection
      description: Get all or loaded collection
      parameters:
        - in: query
          name: type
          type: number
          description: If type is 1 return loaded collections, otherwise return all collections.
      responses:
        200:
          description: CollectionList
          schema:
            type: object
    post:
      tags: 
        - Collection
      description: Create collection in milvus
      requestBody:
        description: Create collection request body
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/CreateCollection'
         
      responses:
        200:
          schema:
            type: object
  /collections/statistics:
    get:
      tags: 
        - Collection
      description: Get all collections statistics like row count
      responses:
        200:
          schema:
            type: object

  /collections/{name}/statistics:
    get:
      tags: 
        - Collection
      description: Get single collection statistics like row count
      parameters:
        - $ref: '#/definitions/CollectionName'

      responses:
        200:
          schema:
            type: object
  /collections/indexes/status:
    get:
      tags: 
        - Collection
      description: Get all collections index status

      responses:
        200:
          schema:
            type: object

  /collections/{name}:
    delete:
      tags: 
        - Collection
      description: Delete collection by name
      parameters:
        - $ref: '#/definitions/CollectionName'
      responses:
        200:
          schema:
            type: object
    get:
      tags: 
        - Collection
      description: Get single collection informations like schema, name, id
      parameters:
        - $ref: '#/definitions/CollectionName'
      responses:
        200:
          schema:
            type: object
  /collections/{name}/load:
    put:
      tags: 
        - Collection
      description: Load data to cache
      parameters:
        - $ref: '#/definitions/CollectionName'
      responses:
        200:
          schema:
            type: object
  /collections/{name}/release:
    put:
      tags: 
        - Collection
      description: Release data from cache
      parameters:
        - $ref: '#/definitions/CollectionName'
      responses:
        200:
          schema:
            type: object
  /collections/{name}/insert:
    post:
      tags: 
        - Collection
      description: Insert data into collection
      parameters:
        - $ref: '#/definitions/CollectionName'
      requestBody:
        description: Insert data into collection
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/Insert'
      responses:
        200:
          schema:
            type: object
            
  /collections/{name}/search:
    post:
      tags: 
        - Collection
      description: Vector search 
      parameters:
        - $ref: '#/definitions/CollectionName'
      requestBody:
        description: Do vector search
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/Search'
      responses:
        200:
          schema:
            type: object

  /collections/{name}/query:
    post:
      tags: 
        - Collection
      description: query data
      parameters:
        - $ref: '#/definitions/CollectionName'
      requestBody:
        description: query data body
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - "expr"
              properties:
                expr:
                  type: string
                  example: id in [1]
      responses:
        200:
          schema:
            type: object      

/collections/{name}/alias:
    post:
      tags: 
        - Collection
      description: Create alias for collection
      parameters:
        - $ref: '#/definitions/CollectionName'
      requestBody:
        description: alias name
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - "alias"
              properties:
                alias:
                  type: string
                  example: collection_alias
      responses:
        200:
          schema:
            type: object                   


definitions:
  CollectionName:
    in: path
    name: name
    type: string
    description: Collection name
  CreateCollection:
    type: object
    required:
      - "collection_name"
      - "fields"
    properties:
      collection_name:
        type: string
        example: collection_01
      fields:
        type: array
        example: []
  Insert:
    type: object
    required:
      - "fields_data"
    properties:
      partition_name:
        type: string
        example: _default
      fields_data:
        type: array
        example: []
      hash_keys:
        type: array
        example: []
  Search:
    type: object
    required:
      - "vectors"
      - "vector_type"
      - "search_params"
    properties:
      vectors:
        type: array
        example: []
        
      vector_type:
        description: BinaryVector - 100 , FloatVector - 101
        type: number
        example: 100 
      search_params:
        type: object
        example: {"anns_field":"","topk":10,"metric_type":"L2","params":""}
