docstr_tok: []
code: def test_collection_create_by_sdk_insert_vector_by_restful(self):
      """ """
      # 1. create collection by sdk
      dim = 128
      nb = 100
      name = gen_collection_name()
      default_fields = [
          FieldSchema(
              name="int64", dtype=DataType.INT64, is_primary=True
          ),
          FieldSchema(name="float", dtype=DataType.FLOAT),
          FieldSchema(
              name="varchar", dtype=DataType.VARCHAR, max_length=65535
          ),
          FieldSchema(
              name="float_vector", dtype=DataType.FLOAT_VECTOR, dim=128
          ),
      ]
      default_schema = CollectionSchema(
          fields=default_fields,
          description="test collection",
          enable_dynamic_field=True,
      )
      collection = Collection(name=name, schema=default_schema)
      # create index by sdk
      index_param = {
          "metric_type": "L2",
          "index_type": "IVF_FLAT",
          "params": {"nlist": 128},
      }
      collection.create_index(
          field_name="float_vector", index_params=index_param
      )
      collection.load()
      # insert data by restful
      data = [
          {
              "int64": i,
              "float": i,
              "varchar": str(i),
              "float_vector": [random.random() for _ in range(dim)],
              "age": i,
          }
          for i in range(nb)
      ]
      client = self.vector_client
      payload = {
          "collectionName": name,
          "data": data,
      }
      rsp = client.vector_insert(payload)
      assert rsp["code"] == 200
      assert rsp["data"]["insertCount"] == nb
  
file_path: milvus/tests/restful_client/testcases/test_restful_sdk_mix_use_scenario.py
imports: import random
  import time
  from utils.utils import gen_collection_name
  from utils.util_log import test_log
  import pytest
  from base.testbase import TestBase
  from pymilvus import FieldSchema, CollectionSchema, DataType, Collection
label_desc: Use image node_id 5 for calling the TestRestfulSdkCompatibility obj's underlying member method code with example usage: obj.test_collection_create_by_sdk_insert_vector_by_restful() without return types