根据标签查询Influxdb?
Query Influxdb based on tags?
我已经开始使用 Influxdb v0.13,我的测试数据库中有一些虚拟值,其中 id
是一个标签,value
是一个字段:
> SELECT * FROM dummy
name: dummy
--------------
time id value
1468276508161069051 1234 12345
1468276539152853428 613 352
1468276543470535110 613 4899
1468276553853436191 1234 12
当我 运行 这个查询时,我没有返回任何结果:
> SELECT * FROM dummy WHERE id=1234
但在查询该字段时我确实得到了以下信息:
> SELECT * FROM dummy WHERE value=12
name: dummy
--------------
time id value
1468276553853436191 1234 12
我是不是做错了什么?我认为要查询标签的意义(因为它们被索引而字段没有),但它们似乎打破了我的查询。
似乎 Influx 会将我们插入的每个标签键和值都视为字符串,这在他们的官方文档中有明显显示。
参见:https://docs.influxdata.com/influxdb/v0.13/guides/writing_data/
When writing points, you must specify an existing database in the db
query parameter. See the HTTP section on the Write Syntax page for a
complete list of the available query parameters. The body of the POST
- we call this the Line Protocol - contains the time-series data that you wish to store. They consist of a measurement, tags, fields, and a
timestamp. InfluxDB requires a measurement name. Strictly speaking,
tags are optional but most series include tags to differentiate data
sources and to make querying both easy and efficient. Both tag keys
and tag values are strings.
注:粗体字。
因此要按标签键值过滤 - 查询必须被引用。
示例:
SELECT * FROM dummy WHERE id='1234'
我已经开始使用 Influxdb v0.13,我的测试数据库中有一些虚拟值,其中 id
是一个标签,value
是一个字段:
> SELECT * FROM dummy
name: dummy
--------------
time id value
1468276508161069051 1234 12345
1468276539152853428 613 352
1468276543470535110 613 4899
1468276553853436191 1234 12
当我 运行 这个查询时,我没有返回任何结果:
> SELECT * FROM dummy WHERE id=1234
但在查询该字段时我确实得到了以下信息:
> SELECT * FROM dummy WHERE value=12
name: dummy
--------------
time id value
1468276553853436191 1234 12
我是不是做错了什么?我认为要查询标签的意义(因为它们被索引而字段没有),但它们似乎打破了我的查询。
似乎 Influx 会将我们插入的每个标签键和值都视为字符串,这在他们的官方文档中有明显显示。
参见:https://docs.influxdata.com/influxdb/v0.13/guides/writing_data/
When writing points, you must specify an existing database in the db query parameter. See the HTTP section on the Write Syntax page for a complete list of the available query parameters. The body of the POST - we call this the Line Protocol - contains the time-series data that you wish to store. They consist of a measurement, tags, fields, and a timestamp. InfluxDB requires a measurement name. Strictly speaking, tags are optional but most series include tags to differentiate data sources and to make querying both easy and efficient. Both tag keys and tag values are strings.
注:粗体字。
因此要按标签键值过滤 - 查询必须被引用。
示例:
SELECT * FROM dummy WHERE id='1234'