All Products
Search
Document Center

Elasticsearch:Integrate aliyun-timestream with the InfluxDB line protocol

Last Updated:Mar 26, 2026

Writes time series data to a time series index in Alibaba Cloud Elasticsearch using the InfluxDB line protocol.

Prerequisites

Before you begin, ensure that you have:

Request syntax

POST /_time_stream/influx/write?db={index}&precision=ns
{infludb lines data}

Request parameters

ParameterRequiredDescription
dbYesThe name of the time series index to write data to.
precisionNoThe timestamp precision. Valid values: n, ns, u, ms, s, m, and h. Default: ns.

Usage notes

InfluxDB line protocol syntax

The request body must be formatted as InfluxDB line protocol. For the full specification, see Line protocol in the InfluxDB documentation.

// Syntax
<measurement>[,<tag_key>=<tag_value>[,<tag_key>=<tag_value>]] <field_key>=<field_value>[,<field_key>=<field_value>] [<timestamp>]

// Example
myMeasurement,tag1=value1,tag2=value2 fieldKey="fieldValue" 1556813561098000000

How measurement names map to Elasticsearch fields

When data is written to a time series index, the measurement name is stored as a field named measurement inside the labels object.

Note If the line protocol data already contains a field named measurement in labels, the measurement name overwrites that field's value.

The following example shows how InfluxDB data maps to an Elasticsearch document.

InfluxDB input:

testInflux,label1=label_value1 metric1=0.5

Elasticsearch output:

{
  "@timestamp": 1669972652000,
  "labels": {
    "measurement": "testInflux",
    "label1": "label_value1"
  },
  "metrics": {
    "metric1": 0.5
  }
}

After the data is written, query it using the Elasticsearch search APIs or the Prometheus APIs integrated with aliyun-timestream.

Examples

Write data

curl -i --user "user:password" "http://xxx:9200/_time_stream/influx/write?db=test_stream" -d "testInflux,label1=label_value1 metric1=0.5"

Response

A successful write returns HTTP 204 with no response body:

HTTP/1.1 204 No Content

If the write fails, the response format follows the InfluxDB write API error format.