Skip to content

Commit

Permalink
Release new docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Milvus-doc-bot authored and Milvus-doc-bot committed Nov 24, 2024
1 parent c7617b1 commit 746a48c
Showing 1 changed file with 0 additions and 63 deletions.
63 changes: 0 additions & 63 deletions v2.4.x/site/en/userGuide/data-import/import-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,69 +29,6 @@ The following code snippet creates a simple collection with the given schema. Fo

</div>

<div class="multipleCode">
<a href="#python">Python </a>
<a href="#java">Java</a>
</div>

```python
from pymilvus import MilvusClient, DataType

client = MilvusClient("http://localhost:19530")

schema = MilvusClient.create_schema(
auto_id=False,
enable_dynamic_field=True
)

DIM = 512

schema.add_field(field_name="id", datatype=DataType.INT64, is_primary=True),
schema.add_field(field_name="bool", datatype=DataType.BOOL),
schema.add_field(field_name="int8", datatype=DataType.INT8),
schema.add_field(field_name="int16", datatype=DataType.INT16),
schema.add_field(field_name="int32", datatype=DataType.INT32),
schema.add_field(field_name="int64", datatype=DataType.INT64),
schema.add_field(field_name="float", datatype=DataType.FLOAT),
schema.add_field(field_name="double", datatype=DataType.DOUBLE),
schema.add_field(field_name="varchar", datatype=DataType.VARCHAR, max_length=512),
schema.add_field(field_name="json", datatype=DataType.JSON),
schema.add_field(field_name="array_str", datatype=DataType.ARRAY, max_capacity=100, element_type=DataType.VARCHAR, max_length=128)
schema.add_field(field_name="array_int", datatype=DataType.ARRAY, max_capacity=100, element_type=DataType.INT64)
schema.add_field(field_name="float_vector", datatype=DataType.FLOAT_VECTOR, dim=DIM),
schema.add_field(field_name="binary_vector", datatype=DataType.BINARY_VECTOR, dim=DIM),
schema.add_field(field_name="float16_vector", datatype=DataType.FLOAT16_VECTOR, dim=DIM),
# schema.add_field(field_name="bfloat16_vector", datatype=DataType.BFLOAT16_VECTOR, dim=DIM),
schema.add_field(field_name="sparse_vector", datatype=DataType.SPARSE_FLOAT_VECTOR)

schema.verify()

client.create_collection(
collection_name="quick_setup",
schema=schema
)
```

```java
private static void createCollection() {
MilvusClientV2 milvusClient = new MilvusClientV2(ConnectConfig.builder()
.uri("http://localhost:19530")
.build());

CreateCollectionReq.CollectionSchema schema = createSchema();
CreateCollectionReq request = CreateCollectionReq.builder()
.collectionName("quick_setup")
.collectionSchema(schema)
.build();
milvusClient.createCollection(request);
System.out.println("Collection created");
}

public static void main(String[] args) throws Exception {
createCollection();
}
```

## Import data

To import the prepared data, you have to create an import job as follows:
Expand Down

0 comments on commit 746a48c

Please sign in to comment.