This chapter introduces how to create tables in Hippo. The following example creates a table named “book” with one shard and one replica. And table “book” has a primary key called “book_id” using Int64 as the data type, a scalar column called “word_count” using Int64 as the data type and a vector column containing Float numbers with 2 dimensions.
curl -u shiva:shiva -XPUT 'localhost:8902/hippo/v1/{table}?database_name={database_name}&pretty' -H 'Content-Type: application/json' -d'{
"settings": {
"number_of_shards" : 1,
"number_of_replicas" : 1
},
"schema": {
"auto_id": false,
"fields": [
{
"name": "book_id",
"is_primary_key": true,
"data_type": "int64"
},
{
"name": "word_count",
"is_primary_key": false,
"data_type": "int64"
},
{
"name": "book_intro",
"data_type": "float_vector",
"is_primary_key": false,
"type_params": {
"dimension" : 2
}
}
]
}
}';
Result:
{
"acknowledged" : true
}
Parameter description:
Parameters | Description | Options |
---|---|---|
table | Table name, such as “book” created in this example | |
database_name | Database name, URL parameter | [1, 5] |
auto_id | If self-generated ID is enabled. Currently Hippo only enables self-generated ID for schema containing only one String primary key | True/False |
fields (schema) | The fields for the newly created schema in this example | |
name (field) | Field name | N/A |
is_primary_key | Whether the column is primary key | True/False |
data_type | Data type for the column | |
dim | Vector dimension | [1, 65536] |
length | Length, varchar/varchar2 data type | [1, 65536] |