To add an index to a table

Method : POST

URI : /db/<dbname>/<table_name>/index

Body

{
  "index_name": <index_name>,
  "key_type": <key_type>,
  "key_size": <key size in bytes>,
  "allow_duplicate": <0 or 1>
}

The body is very similar to that of create table. There are many more attributes here that we could use to set the index in a particular manner.

See the details here.

Example

curl -H "Content-Type: application/json" -d '{"index_name":"org","key_type":1,"key_size":32}' -X POST http://192.168.1.105:18080/db/mydb/my_table_test/index

Response

{
  "msg": "successfully created the index"
}

Stream processing

Register schema for stream processing

Method : POST

URI : /stream

Body:

{ schema doc }

Schema is a json doc which contains information about stream processing. Please see the details for the json doc here.

Example

curl -H "Content-Type: application/json" -d '{"schema": "ecomm","streams":
[{"name":"visitor", "type":1, "swsz":86400,"inpt":[],"attr":
[{"name":"vid","type":5,"kysz":24},{"name":"prod","type":5,"kysz":24},
{"name":"refr","type":5,"kysz":48},{"name":"price","type":11},
{"name":"items","type":9}]}]}' -X POST http://192.168.1.105:18080/stream

Response

{
   "errcode": 0
}

Here is errcode is 0 then the operation is successful, we may get some messages but as long as errcode is 0, it means the registration was successful.