10.13.20.15:9200
, which can be obtained in the console./_metric/${metric_name}/update
, where ${metric_name}
is the metric name.
Method: PUTtags
, time
, fields
, and options
fields are all of the map
type and optional. For their formats, see Creating Metric. The specific requirements are as detailed below:
tags: You can add tag fields and modify the types of existing ones without deleting them.
time: You cannot modify name
but can modify format
.
fields: You can add metric fields and modify the types of existing ones without deleting them.
options
attributes are as detailed below:Attribute name | Required | Type | Description |
expire_day | No | integer | Data expiration time, which is a non-zero integer. Once expired, the data will be automatically cleared. By default, data never expires. |
refresh_interval | No | string | Data refresh interval, which is 10 seconds by default. The written data can be queried after being refreshed from the memory to disk. |
number_of_shards | No | integer | Number of metric shards, which is a positive integer and 3 by default. This parameter can be ignored for small metrics. A large metric can be divided into shards, and each shard can be up to 25 GB in size. |
number_of_replicas | No | integer | Number of replicas, which is a non-negative integer; for example, 1 indicates one master and one replica. The default value is 1 . |
rolling_period | No | integer | Child metric period (in days), which is a non-zero integer. When CTSDB stores data, to facilitate data expiration and improve query efficiency, it stores data into child metrics by the specified time interval, which is subject to the data expiration time by default. |
max_string_length | No | integer | Maximum length of a custom string, which is a positive integer. Its maximum value is 32765 , and its default value is 256 . |
default_date_format | No | string | Format of the date data type of custom tags and fields, which is strict_date_optional_time or epoch_millis by default. |
indexed_fields | No | array | Fields whose indexes need to be retained in the fields. You can use an array to specify multiple fields. |
default_type | No | string | Default type of new fields. Its valid values are tag and field , and its default value is tag . |
GET /_metric/${metric_name}?v
API.short
, integer
, float
data types can be changed to another type. The short
type can be changed to the integer
or long
type, integer
to long
, and float
to double
.error
field. If the response content contains the error
field, the request failed. For the error details, see the error
field description.curl -u root:le201909 -H 'Content-Type:application/json' -X PUT 172.16.345.14:9201/_metric/ctsdb_test/update -d'{"tags":{"set":"string"},"time":{"name":"timestamp","format":"epoch_second"},"fields":{"diskUsage":"float"},"options":{"expire_day":15,"number_of_shards":10}}'
{"acknowledged": true,"message": "update ctsdb metric test111 success!"}
Was this page helpful?