This chapter introduces how to check table information.
Table Exists
curl -u shiva:shiva -XGET 'localhost:8902/hippo/v1/_check_table_existence?database_name={database_name}&pretty' -H 'Content-Type: application/json' -d'{
"database_name" : "book",
"table_name" : "book"
}'
Result:
{
"acknowledged" : true
}
Parameter description:
Parameters | Description | Required |
---|---|---|
table_name | Table name | Yes |
database_name | The database where the table is located | No, defaults to "default" database |
Get Table Details
curl -u shiva:shiva -XGET 'localhost:8902/hippo/v1/{table}?database_name={database_name}&pretty'
Result:
{
"book" : {
"id" : "b41cab6e3418434a9d820f0405263303",
"database" : "default",
"settings" : {
"number_of_shards" : 1,
"creation_date" : "2023-05-21 22:22:13",
"number_of_replicas" : 1,
"data_center" : "DEFAULT",
"dc_affinity" : false,
"disaster_preparedness" : false,
"scatter_replica" : false
},
"schema" : {
"fields" : [
{
"name" : "book_id",
"id" : 0,
"is_primary_key" : true,
"is_nullable" : false,
"data_type" : "BIGINT"
},
{
"name" : "word_count",
"id" : 1,
"is_primary_key" : false,
"is_nullable" : true,
"data_type" : "BIGINT"
},
{
"name" : "book_intro",
"id" : 2,
"is_primary_key" : false,
"is_nullable" : true,
"data_type" : "FLOAT_VECTOR",
"type_params" : {
"dimension" : 2
}
},
{
"name" : "__schemaversion__",
"id" : 3,
"is_primary_key" : false,
"is_nullable" : true,
"data_type" : "BIGINT"
},
{
"name" : "__rowid__",
"id" : 4,
"is_primary_key" : false,
"is_nullable" : true,
"data_type" : "BIGINT"
}
]
},
"embedding_indexes" : [
{
"name" : "book_intro_index",
"id" : 0,
"column" : "book_intro",
"index_type" : "IVF_FLAT",
"metric_type" : "L2",
"params" : {
"nlist" : 10
}
}
]
}
}
Parameter description:
Parameters | Description | Required |
---|---|---|
table | Table to be matched, supports using asterisk (*) wildcard character and specifying multiple pattens, which are separated by comma (,) | Yes |
database_name | The database where the table is located | No, defaults to "default" database |
List Table
The following command introduces how to list the tables of specified database, and the table name, table status, ID and other basic information will be returned.
curl -u shiva:shiva -XGET 'localhost:8902/hippo/v1/_cat/tables/{table}?database_name={database_name}&v' ## {table} can be the keyword of table name or table name (If more than one table name is specified, please use comma to separate)
curl -u shiva:shiva -XGET 'localhost:8902/hippo/v1/_cat/tables?database_name={database_name}&v' ## List all tables stored in current database
Result:
This example shows the information of all tables including the keyword “openai”.
This example shows the information of two tables: “book” and “nt1”.
This example shows the information of all tables stored in specified database. If not specified, all tables of “default” database will be listed.
Parameter description:
Parameters | Description | Required |
---|---|---|
table | Table to be matched, supports using asterisk (*) wildcard character and specifying multiple pattens, which are separated by comma (,) | No, defaults to *, lists all the tables |
database_name | The database where the table is located | No, defaults to "default" database |
List Shard
The following commands will return the shard information, as well as the statistics, in the database.
curl -u shiva:shiva -XGET 'localhost:8902/hippo/v1/_cat/shards/{table}?database_name={database_name}&v' ## {table} can be the keyword of table name or the whole table name (If more than one table name is specified, please use comma to separate)
curl -u shiva:shiva -XGET 'localhost:8902/hippo/v1/_cat/shards?database_name={database_name}&v' ## List the shards of all tables stored in current database
Result:
The APIs used to list shards are similar to the ones used to list tables.
Parameter description:
Parameters | Description | Required |
---|---|---|
table | Table to be matched, supports using asterisk (*) wildcard character and specifying multiple pattens, which are separated by comma (,) | No, defaults to *, lists all the tables |
database_name | The database where the table is located | No, defaults to "default" database |