Merge branch 'master' into jts-5948-fix-influxdb3-install
commit
ae48e5a6a1
|
@ -29,7 +29,7 @@ to delete a bucket.
|
||||||
|
|
||||||
## Delete a bucket using the influx CLI
|
## Delete a bucket using the influx CLI
|
||||||
|
|
||||||
Use the [`influx bucket delete` command](/influxdb/v2/reference/cli/influx/bucket/delete)
|
Use the [`influx bucket delete` command](/influxdb/version/reference/cli/influx/bucket/delete)
|
||||||
to delete a bucket a bucket by name or ID.
|
to delete a bucket a bucket by name or ID.
|
||||||
|
|
||||||
### Delete a bucket by name
|
### Delete a bucket by name
|
||||||
|
|
|
@ -91,9 +91,9 @@ find the token you want to clone and click the **{{< icon "settings" >}}** icon
|
||||||
|
|
||||||
## Create a token using the influx CLI
|
## Create a token using the influx CLI
|
||||||
|
|
||||||
Use the [`influx auth create` command](/influxdb/v2/reference/cli/influx/auth/create) to create a token.
|
Use the [`influx auth create` command](/influxdb/version/reference/cli/influx/auth/create) to create a token.
|
||||||
Include flags with the command to grant specific permissions to the token.
|
Include flags with the command to grant specific permissions to the token.
|
||||||
See the [available flags](/influxdb/v2/reference/cli/influx/auth/create#flags).
|
See the [available flags](/influxdb/version/reference/cli/influx/auth/create#flags).
|
||||||
Only tokens with the `write: authorizations` permission can create tokens.
|
Only tokens with the `write: authorizations` permission can create tokens.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -125,9 +125,9 @@ influx auth create \
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
To [view or create an operator token](/influxdb/v2/admin/tokens/create-token/) with the InfluxDB UI, `api/v2` API, or `influx` CLI after the setup process is completed, you must use an existing operator token.
|
To [view or create an operator token](/influxdb/version/admin/tokens/create-token/) with the InfluxDB UI, `api/v2` API, or `influx` CLI after the setup process is completed, you must use an existing operator token.
|
||||||
|
|
||||||
To create a new operator token without using an existing one, see how to use the [`influxd recovery auth`](/influxdb/v2/reference/cli/influxd/recovery/auth/) CLI.
|
To create a new operator token without using an existing one, see how to use the [`influxd recovery auth`](/influxdb/version/reference/cli/influxd/recovery/auth/) CLI.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
{{% /show-in %}}
|
{{% /show-in %}}
|
||||||
|
|
||||||
|
@ -166,19 +166,19 @@ influx auth create \
|
||||||
--write-users
|
--write-users
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [`influx auth create` documentation](/influxdb/v2/reference/cli/influx/auth/create) for information about other available flags.
|
See the [`influx auth create` documentation](/influxdb/version/reference/cli/influx/auth/create) for information about other available flags.
|
||||||
|
|
||||||
## Create a token using the InfluxDB API
|
## Create a token using the InfluxDB API
|
||||||
|
|
||||||
Use the `/api/v2/authorizations` InfluxDB API endpoint to create a token.
|
Use the `/api/v2/authorizations` InfluxDB API endpoint to create a token.
|
||||||
|
|
||||||
{{< api-endpoint method="POST" endpoint="http://localhost:8086/api/v2/authorizations" api-ref="/influxdb/v2/api/#operation/PostAuthorizations" >}}
|
{{< api-endpoint method="POST" endpoint="http://localhost:8086/api/v2/authorizations" api-ref="/influxdb/version/api/#operation/PostAuthorizations" >}}
|
||||||
|
|
||||||
Include the following in your request:
|
Include the following in your request:
|
||||||
|
|
||||||
| Requirement | Include by |
|
| Requirement | Include by |
|
||||||
|:----------- |:---------- |
|
|:----------- |:---------- |
|
||||||
| API token with the [`write: authorizations`](/influxdb/v2/api/#operation/PostAuthorizations) permission | Use the `Authorization` header and the {{% show-in "v2" %}}`Bearer` or {{% /show-in %}}`Token` scheme. |
|
| API token with the [`write: authorizations`](/influxdb/version/api/#operation/PostAuthorizations) permission | Use the `Authorization` header and the {{% show-in "v2" %}}`Bearer` or {{% /show-in %}}`Token` scheme. |
|
||||||
| Organization | Pass as `orgID` in the request body.
|
| Organization | Pass as `orgID` in the request body.
|
||||||
| Permissions list | Pass as a `permissions` array in the request body.
|
| Permissions list | Pass as a `permissions` array in the request body.
|
||||||
|
|
||||||
|
@ -196,5 +196,5 @@ body.
|
||||||
```
|
```
|
||||||
|
|
||||||
See the
|
See the
|
||||||
[`POST /api/v2/authorizations` documentation](/influxdb/v2/api/#operation/PostAuthorizations)
|
[`POST /api/v2/authorizations` documentation](/influxdb/version/api/#operation/PostAuthorizations)
|
||||||
for more information about options.
|
for more information about options.
|
||||||
|
|
|
@ -35,7 +35,7 @@ have access to your InfluxDB instance.
|
||||||
|
|
||||||
## Delete a token using the influx CLI
|
## Delete a token using the influx CLI
|
||||||
|
|
||||||
Use the [`influx auth delete` command](/influxdb/v2/reference/cli/influx/auth/delete)
|
Use the [`influx auth delete` command](/influxdb/version/reference/cli/influx/auth/delete)
|
||||||
to delete a token.
|
to delete a token.
|
||||||
|
|
||||||
_This command requires an auth ID, which is available in the output of `influx auth find`._
|
_This command requires an auth ID, which is available in the output of `influx auth find`._
|
||||||
|
@ -52,13 +52,13 @@ influx auth delete -i 03a2bee5a9c9a000
|
||||||
|
|
||||||
Use the `/api/v2/authorizations` InfluxDB API endpoint to delete a token.
|
Use the `/api/v2/authorizations` InfluxDB API endpoint to delete a token.
|
||||||
|
|
||||||
{{< api-endpoint method="DELETE" endpoint="http://localhost:8086/api/v2/authorizations/AUTH_ID" api-ref="/influxdb/v2/api/#operation/DeleteAuthorizationsID" >}}
|
{{< api-endpoint method="DELETE" endpoint="http://localhost:8086/api/v2/authorizations/AUTH_ID" api-ref="/influxdb/version/api/#operation/DeleteAuthorizationsID" >}}
|
||||||
|
|
||||||
Include the following in your request:
|
Include the following in your request:
|
||||||
|
|
||||||
| Requirement | Include by |
|
| Requirement | Include by |
|
||||||
|:----------- |:---------- |
|
|:----------- |:---------- |
|
||||||
| API token with the [`write: authorizations`](/influxdb/v2/api/#operation/PostAuthorizations) permission | Use the `Authorization: Token YOUR_API_TOKEN` header. |
|
| API token with the [`write: authorizations`](/influxdb/version/api/#operation/PostAuthorizations) permission | Use the `Authorization: Token YOUR_API_TOKEN` header. |
|
||||||
| Authorization ID | URL path parameter. |
|
| Authorization ID | URL path parameter. |
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
|
@ -43,7 +43,7 @@ using the InfluxDB user interface (UI).
|
||||||
|
|
||||||
## Enable a token using the influx CLI
|
## Enable a token using the influx CLI
|
||||||
|
|
||||||
Use the [`influx auth active` command](/influxdb/v2/reference/cli/influx/auth/active)
|
Use the [`influx auth active` command](/influxdb/version/reference/cli/influx/auth/active)
|
||||||
to activate a token.
|
to activate a token.
|
||||||
|
|
||||||
_This command requires an authorization ID, which is available in the output of `influx auth find`._
|
_This command requires an authorization ID, which is available in the output of `influx auth find`._
|
||||||
|
@ -55,7 +55,7 @@ influx auth active -i <auth-id>
|
||||||
# Example
|
# Example
|
||||||
influx auth active -i 0804f74142bbf000
|
influx auth active -i 0804f74142bbf000
|
||||||
```
|
```
|
||||||
To get the current status of a token, use the JSON output of the [`influx auth list` command](/influxdb/v2/reference/cli/influx/auth/list).
|
To get the current status of a token, use the JSON output of the [`influx auth list` command](/influxdb/version/reference/cli/influx/auth/list).
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influx auth find --json
|
influx auth find --json
|
||||||
|
@ -63,7 +63,7 @@ influx auth find --json
|
||||||
|
|
||||||
### Disable a token using the influx CLI
|
### Disable a token using the influx CLI
|
||||||
|
|
||||||
Use the [`influx auth inactive` command](/influxdb/v2/reference/cli/influx/auth/active)
|
Use the [`influx auth inactive` command](/influxdb/version/reference/cli/influx/auth/active)
|
||||||
to deactivate a token.
|
to deactivate a token.
|
||||||
|
|
||||||
_This command requires an authorization ID, which is available in the output of `influx auth find`._
|
_This command requires an authorization ID, which is available in the output of `influx auth find`._
|
||||||
|
@ -76,7 +76,7 @@ influx auth inactive -i <auth-id>
|
||||||
influx auth inactive -i 0804f74142bbf000
|
influx auth inactive -i 0804f74142bbf000
|
||||||
```
|
```
|
||||||
|
|
||||||
To get the current status of a token, use the JSON output of the [`influx auth list` command](/influxdb/v2/reference/cli/influx/auth/list).
|
To get the current status of a token, use the JSON output of the [`influx auth list` command](/influxdb/version/reference/cli/influx/auth/list).
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influx auth find --json
|
influx auth find --json
|
||||||
|
@ -86,13 +86,13 @@ influx auth find --json
|
||||||
|
|
||||||
Use the `/api/v2/authorizations` InfluxDB API endpoint to update the description and status of a token.
|
Use the `/api/v2/authorizations` InfluxDB API endpoint to update the description and status of a token.
|
||||||
|
|
||||||
{{< api-endpoint method="PATCH" endpoint="http://localhost:8086/api/v2/authorizations/AUTH_ID" api-ref="/influxdb/v2/api/#operation/PatchAuthorizationsID" >}}
|
{{< api-endpoint method="PATCH" endpoint="http://localhost:8086/api/v2/authorizations/AUTH_ID" api-ref="/influxdb/version/api/#operation/PatchAuthorizationsID" >}}
|
||||||
|
|
||||||
Include the following in your request:
|
Include the following in your request:
|
||||||
|
|
||||||
| Requirement | Include by |
|
| Requirement | Include by |
|
||||||
|:----------- |:---------- |
|
|:----------- |:---------- |
|
||||||
| API token with the [`write: authorizations`](/influxdb/v2/api/#operation/PostAuthorizations) permission | Use the `Authorization: Token YOUR_API_TOKEN` header. |
|
| API token with the [`write: authorizations`](/influxdb/version/api/#operation/PostAuthorizations) permission | Use the `Authorization: Token YOUR_API_TOKEN` header. |
|
||||||
| Authorization ID | URL path parameter. |
|
| Authorization ID | URL path parameter. |
|
||||||
| Description and/or Status | Pass as `description`, `status` in the request body. |
|
| Description and/or Status | Pass as `description`, `status` in the request body. |
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
Use tokens to authenticate requests to InfluxDB, including requests to write, query, and manage data and resources.
|
Use tokens to authenticate requests to InfluxDB, including requests to write, query, and manage data and resources.
|
||||||
Authenticate requests using the [`influx` CLI](/influxdb/v2/reference/cli/influx/), API requests made with client libraries, and tools like `curl`.
|
Authenticate requests using the [`influx` CLI](/influxdb/version/reference/cli/influx/), API requests made with client libraries, and tools like `curl`.
|
||||||
|
|
||||||
### Add a token to a CLI request
|
### Add a token to a CLI request
|
||||||
|
|
||||||
|
@ -14,19 +14,19 @@ influx write -t $INFLUX_TOKEN -b my-bucket -o my-org "measurement field=1"
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
See [here](/influxdb/v2/write-data/no-code/use-telegraf/auto-config/#configure-your-token-as-an-environment-variable)
|
See [here](/influxdb/version/write-data/no-code/use-telegraf/auto-config/#configure-your-token-as-an-environment-variable)
|
||||||
to configure environment variables on Windows.
|
to configure environment variables on Windows.
|
||||||
(Click on the **Windows** tab.)
|
(Click on the **Windows** tab.)
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
### Use CLI configurations
|
### Use CLI configurations
|
||||||
|
|
||||||
Automatically manage and use tokens from the CLI using [`influx config`](/influxdb/v2/reference/cli/influx/config/).
|
Automatically manage and use tokens from the CLI using [`influx config`](/influxdb/version/reference/cli/influx/config/).
|
||||||
|
|
||||||
### Use a token in an API request
|
### Use a token in an API request
|
||||||
|
|
||||||
Use tokens in [API requests](/influxdb/v2/api-guide/api_intro/#authentication).
|
Use tokens in [API requests](/influxdb/version/api-guide/api_intro/#authentication).
|
||||||
|
|
||||||
### Use a token in Postman
|
### Use a token in Postman
|
||||||
|
|
||||||
Make authenticated requests with tokens [using Postman](/influxdb/v2/tools/postman/).
|
Make authenticated requests with tokens [using Postman](/influxdb/version/tools/postman/).
|
||||||
|
|
|
@ -47,7 +47,7 @@ We recommend the following for managing your tokens:
|
||||||
|
|
||||||
## View tokens using the influx CLI
|
## View tokens using the influx CLI
|
||||||
|
|
||||||
Use the [`influx auth list` command](/influxdb/v2/reference/cli/influx/auth/list)
|
Use the [`influx auth list` command](/influxdb/version/reference/cli/influx/auth/list)
|
||||||
to view tokens.
|
to view tokens.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -55,20 +55,20 @@ influx auth list
|
||||||
```
|
```
|
||||||
|
|
||||||
Filtering options such as filtering by authorization ID, username, or user ID are available.
|
Filtering options such as filtering by authorization ID, username, or user ID are available.
|
||||||
See the [`influx auth list` documentation](/influxdb/v2/reference/cli/influx/auth/list)
|
See the [`influx auth list` documentation](/influxdb/version/reference/cli/influx/auth/list)
|
||||||
for information about other available flags.
|
for information about other available flags.
|
||||||
|
|
||||||
## View tokens using the InfluxDB API
|
## View tokens using the InfluxDB API
|
||||||
|
|
||||||
Use the `/api/v2/authorizations` InfluxDB API endpoint to view tokens and permissions.
|
Use the `/api/v2/authorizations` InfluxDB API endpoint to view tokens and permissions.
|
||||||
|
|
||||||
{{< api-endpoint method="GET" endpoint="/api/v2/authorizations" api-ref="/influxdb/v2/api/#operation/GetAuthorizations" >}}
|
{{< api-endpoint method="GET" endpoint="/api/v2/authorizations" api-ref="/influxdb/version/api/#operation/GetAuthorizations" >}}
|
||||||
|
|
||||||
Include the following in your request:
|
Include the following in your request:
|
||||||
|
|
||||||
| Requirement | Include by |
|
| Requirement | Include by |
|
||||||
|:----------- |:---------- |
|
|:----------- |:---------- |
|
||||||
| API token with the [`read: authorizations`](/influxdb/v2/api/#operation/PostAuthorizations) permission | Use the `Authorization: Token YOUR_API_TOKEN` header. |
|
| API token with the [`read: authorizations`](/influxdb/version/api/#operation/PostAuthorizations) permission | Use the `Authorization: Token YOUR_API_TOKEN` header. |
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
{{% get-shared-text "api/v2.0/auth/oss/tokens-view.sh" %}}
|
{{% get-shared-text "api/v2.0/auth/oss/tokens-view.sh" %}}
|
||||||
|
@ -78,7 +78,7 @@ Include the following in your request:
|
||||||
|
|
||||||
To view a specific authorization and token, include the authorization ID in the URL path.
|
To view a specific authorization and token, include the authorization ID in the URL path.
|
||||||
|
|
||||||
{{% api-endpoint method="GET" endpoint="/api/v2/authorizations/{authID}" api-ref="/influxdb/v2/api/#operation/GetAuthorizationsID" %}}
|
{{% api-endpoint method="GET" endpoint="/api/v2/authorizations/{authID}" api-ref="/influxdb/version/api/#operation/GetAuthorizationsID" %}}
|
||||||
|
|
||||||
### Filter the token list
|
### Filter the token list
|
||||||
|
|
||||||
|
@ -91,9 +91,9 @@ To filter tokens by user, include `userID` as a query parameter in your request.
|
||||||
|
|
||||||
{{% show-in "v2" %}}
|
{{% show-in "v2" %}}
|
||||||
|
|
||||||
[***Operator tokens***](/influxdb/v2/admin/tokens/#operator-token) have access to all organizations' authorizations.
|
[***Operator tokens***](/influxdb/version/admin/tokens/#operator-token) have access to all organizations' authorizations.
|
||||||
To filter authorizations by organization when using an operator token, include an `org` or `orgID` query parameter in your request.
|
To filter authorizations by organization when using an operator token, include an `org` or `orgID` query parameter in your request.
|
||||||
|
|
||||||
{{% /show-in %}}
|
{{% /show-in %}}
|
||||||
|
|
||||||
See the [`/authorizations` endpoint documentation](/influxdb/v2/api/#tag/Authorizations-(API-tokens)) for more information about available parameters.
|
See the [`/authorizations` endpoint documentation](/influxdb/version/api/#tag/Authorizations-(API-tokens)) for more information about available parameters.
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
|
|
||||||
InfluxDB offers a rich API and [client libraries](/influxdb/v2/api-guide/client-libraries) ready to integrate with your application. Use popular tools like Curl and [Postman](/influxdb/v2/api-guide/postman) for rapidly testing API requests.
|
InfluxDB offers a rich API and [client libraries](/influxdb/version/api-guide/client-libraries) ready to integrate with your application. Use popular tools like Curl and [Postman](/influxdb/version/api-guide/postman) for rapidly testing API requests.
|
||||||
|
|
||||||
This section guides you through the most commonly used API methods.
|
This section guides you through the most commonly used API methods.
|
||||||
|
|
||||||
For detailed documentation on the entire API, see the [InfluxDB v2 API Reference](/influxdb/v2/reference/api/#influxdb-v2-api-documentation).
|
For detailed documentation on the entire API, see the [InfluxDB v2 API Reference](/influxdb/version/reference/api/#influxdb-v2-api-documentation).
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
If you need to use InfluxDB {{< current-version >}} with **InfluxDB 1.x** API clients and integrations, see the [1.x compatibility API](/influxdb/v2/reference/api/#influxdb-v1-compatibility-api-reference-documentation).
|
If you need to use InfluxDB {{< current-version >}} with **InfluxDB 1.x** API clients and integrations, see the [1.x compatibility API](/influxdb/version/reference/api/#influxdb-v1-compatibility-api-reference-documentation).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
## Bootstrap your application
|
## Bootstrap your application
|
||||||
|
|
||||||
With most API requests, you'll need to provide a minimum of your InfluxDB URL and Authorization Token (API Token).
|
With most API requests, you'll need to provide a minimum of your InfluxDB URL and Authorization Token (API Token).
|
||||||
|
|
||||||
[Install InfluxDB OSS v2.x](/influxdb/v2/install/) or upgrade to
|
[Install InfluxDB OSS v2.x](/influxdb/version/install/) or upgrade to
|
||||||
an [InfluxDB Cloud account](/influxdb/cloud/sign-up).
|
an [InfluxDB Cloud account](/influxdb/cloud/sign-up).
|
||||||
|
|
||||||
### Authentication
|
### Authentication
|
||||||
|
|
||||||
InfluxDB uses [API tokens](/influxdb/v2/admin/tokens/) to authorize API requests.
|
InfluxDB uses [API tokens](/influxdb/version/admin/tokens/) to authorize API requests.
|
||||||
|
|
||||||
1. Before exploring the API, use the InfluxDB UI to
|
1. Before exploring the API, use the InfluxDB UI to
|
||||||
[create an initial API token](/influxdb/v2/admin/tokens/create-token/) for your application.
|
[create an initial API token](/influxdb/version/admin/tokens/create-token/) for your application.
|
||||||
|
|
||||||
2. Include your API token in an `Authorization: Token YOUR_API_TOKEN` HTTP header with each request.
|
2. Include your API token in an `Authorization: Token YOUR_API_TOKEN` HTTP header with each request.
|
||||||
|
|
||||||
|
@ -42,12 +42,12 @@ InfluxDB uses [API tokens](/influxdb/v2/admin/tokens/) to authorize API requests
|
||||||
{{% /code-tab-content %}}
|
{{% /code-tab-content %}}
|
||||||
{{< /code-tabs-wrapper >}}
|
{{< /code-tabs-wrapper >}}
|
||||||
|
|
||||||
Postman is another popular tool for exploring APIs. See how to [send authenticated requests with Postman](/influxdb/v2/tools/postman/#send-authenticated-api-requests-with-postman).
|
Postman is another popular tool for exploring APIs. See how to [send authenticated requests with Postman](/influxdb/version/tools/postman/#send-authenticated-api-requests-with-postman).
|
||||||
|
|
||||||
## Buckets API
|
## Buckets API
|
||||||
|
|
||||||
Before writing data you'll need to create a Bucket in InfluxDB.
|
Before writing data you'll need to create a Bucket in InfluxDB.
|
||||||
[Create a bucket](/influxdb/v2/admin/buckets/create-bucket/#create-a-bucket-using-the-influxdb-api) using an HTTP request to the InfluxDB API `/buckets` endpoint.
|
[Create a bucket](/influxdb/version/admin/buckets/create-bucket/#create-a-bucket-using-the-influxdb-api) using an HTTP request to the InfluxDB API `/buckets` endpoint.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
{{% get-shared-text "api/v2.0/buckets/oss/create.sh" %}}
|
{{% get-shared-text "api/v2.0/buckets/oss/create.sh" %}}
|
||||||
|
@ -55,8 +55,8 @@ Before writing data you'll need to create a Bucket in InfluxDB.
|
||||||
|
|
||||||
## Write API
|
## Write API
|
||||||
|
|
||||||
[Write data to InfluxDB](/influxdb/v2/write-data/developer-tools/api/) using an HTTP request to the InfluxDB API `/api/v2/write` endpoint.
|
[Write data to InfluxDB](/influxdb/version/write-data/developer-tools/api/) using an HTTP request to the InfluxDB API `/api/v2/write` endpoint.
|
||||||
|
|
||||||
## Query API
|
## Query API
|
||||||
|
|
||||||
[Query from InfluxDB](/influxdb/v2/query-data/execute-queries/influx-api/) using an HTTP request to the `/api/v2/query` endpoint.
|
[Query from InfluxDB](/influxdb/version/query-data/execute-queries/influx-api/) using an HTTP request to the `/api/v2/query` endpoint.
|
||||||
|
|
|
@ -5,7 +5,7 @@ Use the [InfluxDB JavaScript client library](https://github.com/influxdata/influ
|
||||||
* Bundled UMD
|
* Bundled UMD
|
||||||
|
|
||||||
This guide presumes some familiarity with JavaScript, browser environments, and InfluxDB.
|
This guide presumes some familiarity with JavaScript, browser environments, and InfluxDB.
|
||||||
If you're just getting started with InfluxDB, see [Get started with InfluxDB](/influxdb/v2/get-started/).
|
If you're just getting started with InfluxDB, see [Get started with InfluxDB](/influxdb/version/get-started/).
|
||||||
|
|
||||||
{{% warn %}}
|
{{% warn %}}
|
||||||
### Tokens in production applications
|
### Tokens in production applications
|
||||||
|
@ -22,12 +22,12 @@ If you're just getting started with InfluxDB, see [Get started with InfluxDB](/i
|
||||||
1. Install [Node.js](https://nodejs.org/en/download/package-manager/) to serve your front-end app.
|
1. Install [Node.js](https://nodejs.org/en/download/package-manager/) to serve your front-end app.
|
||||||
|
|
||||||
2. Ensure that InfluxDB is running and you can connect to it.
|
2. Ensure that InfluxDB is running and you can connect to it.
|
||||||
For information about what URL to use to connect to InfluxDB OSS or InfluxDB Cloud, see [InfluxDB URLs](/influxdb/v2/reference/urls/).
|
For information about what URL to use to connect to InfluxDB OSS or InfluxDB Cloud, see [InfluxDB URLs](/influxdb/version/reference/urls/).
|
||||||
|
|
||||||
## Use with module bundlers
|
## Use with module bundlers
|
||||||
|
|
||||||
If you use a module bundler like Webpack or Parcel, install `@influxdata/influxdb-client-browser`.
|
If you use a module bundler like Webpack or Parcel, install `@influxdata/influxdb-client-browser`.
|
||||||
For more information and examples, see [Node.js](/influxdb/v2/api-guide/client-libraries/nodejs/).
|
For more information and examples, see [Node.js](/influxdb/version/api-guide/client-libraries/nodejs/).
|
||||||
|
|
||||||
## Use bundled distributions with browsers and module loaders
|
## Use bundled distributions with browsers and module loaders
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ For more information and examples, see [Node.js](/influxdb/v2/api-guide/client-l
|
||||||
{{% /code-tab-content %}}
|
{{% /code-tab-content %}}
|
||||||
{{< /code-tabs-wrapper >}}
|
{{< /code-tabs-wrapper >}}
|
||||||
|
|
||||||
After you've imported the client library, you're ready to [write data](/influxdb/v2/api-guide/client-libraries/nodejs/write/?t=nodejs) to InfluxDB.
|
After you've imported the client library, you're ready to [write data](/influxdb/version/api-guide/client-libraries/nodejs/write/?t=nodejs) to InfluxDB.
|
||||||
|
|
||||||
## Get started with the example app
|
## Get started with the example app
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ This library includes an example browser app that queries from and writes to you
|
||||||
cd examples
|
cd examples
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Update `./env_browser.js` with your InfluxDB [url](/influxdb/v2/reference/urls/), [bucket](/influxdb/v2/admin/buckets/), [organization](/influxdb/v2/admin/organizations/), and [token](/influxdb/v2/admin/tokens/)
|
3. Update `./env_browser.js` with your InfluxDB [url](/influxdb/version/reference/urls/), [bucket](/influxdb/version/admin/buckets/), [organization](/influxdb/version/admin/organizations/), and [token](/influxdb/version/admin/tokens/)
|
||||||
|
|
||||||
4. Run the following command to start the application at [http://localhost:3001/examples/index.html]()
|
4. Run the following command to start the application at [http://localhost:3001/examples/index.html]()
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Use the [InfluxDB Go client library](https://github.com/influxdata/influxdb-client-go) to integrate InfluxDB into Go scripts and applications.
|
Use the [InfluxDB Go client library](https://github.com/influxdata/influxdb-client-go) to integrate InfluxDB into Go scripts and applications.
|
||||||
|
|
||||||
This guide presumes some familiarity with Go and InfluxDB.
|
This guide presumes some familiarity with Go and InfluxDB.
|
||||||
If just getting started, see [Get started with InfluxDB](/influxdb/v2/get-started/).
|
If just getting started, see [Get started with InfluxDB](/influxdb/version/get-started/).
|
||||||
|
|
||||||
## Before you begin
|
## Before you begin
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ If just getting started, see [Get started with InfluxDB](/influxdb/v2/get-starte
|
||||||
go get github.com/influxdata/influxdb-client-go/v2
|
go get github.com/influxdata/influxdb-client-go/v2
|
||||||
```
|
```
|
||||||
3. Ensure that InfluxDB is running and you can connect to it.
|
3. Ensure that InfluxDB is running and you can connect to it.
|
||||||
For information about what URL to use to connect to InfluxDB OSS or InfluxDB Cloud, see [InfluxDB URLs](/influxdb/v2/reference/urls/).
|
For information about what URL to use to connect to InfluxDB OSS or InfluxDB Cloud, see [InfluxDB URLs](/influxdb/version/reference/urls/).
|
||||||
|
|
||||||
## Boilerplate for the InfluxDB Go Client Library
|
## Boilerplate for the InfluxDB Go Client Library
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ Use the Go library to write and query data from InfluxDB.
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Define variables for your InfluxDB [bucket](/influxdb/v2/admin/buckets/), [organization](/influxdb/v2/admin/organizations/), and [token](/influxdb/v2/admin/tokens/).
|
2. Define variables for your InfluxDB [bucket](/influxdb/version/admin/buckets/), [organization](/influxdb/version/admin/organizations/), and [token](/influxdb/version/admin/tokens/).
|
||||||
|
|
||||||
```go
|
```go
|
||||||
bucket := "example-bucket"
|
bucket := "example-bucket"
|
||||||
|
@ -66,7 +66,7 @@ Use the Go library to write and query data from InfluxDB.
|
||||||
|
|
||||||
Use the Go library to write data to InfluxDB.
|
Use the Go library to write data to InfluxDB.
|
||||||
|
|
||||||
1. Create a [point](/influxdb/v2/reference/glossary/#point) and write it to InfluxDB using the `WritePoint` method of the API writer struct.
|
1. Create a [point](/influxdb/version/reference/glossary/#point) and write it to InfluxDB using the `WritePoint` method of the API writer struct.
|
||||||
|
|
||||||
2. Close the client to flush all pending writes and finish.
|
2. Close the client to flush all pending writes and finish.
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
1. Install [Node.js](https://nodejs.org/en/download/package-manager/).
|
1. Install [Node.js](https://nodejs.org/en/download/package-manager/).
|
||||||
|
|
||||||
2. Ensure that InfluxDB is running and you can connect to it.
|
2. Ensure that InfluxDB is running and you can connect to it.
|
||||||
For information about what URL to use to connect to InfluxDB OSS or InfluxDB Cloud, see [InfluxDB URLs](/influxdb/v2/reference/urls/).
|
For information about what URL to use to connect to InfluxDB OSS or InfluxDB Cloud, see [InfluxDB URLs](/influxdb/version/reference/urls/).
|
||||||
|
|
||||||
3. Create a directory for your new Node.js project, and then change to the
|
3. Create a directory for your new Node.js project, and then change to the
|
||||||
directory--for example, enter the following command into your terminal:
|
directory--for example, enter the following command into your terminal:
|
||||||
|
@ -69,7 +69,7 @@ Add both as dependencies of your project.
|
||||||
|
|
||||||
## Next steps
|
## Next steps
|
||||||
|
|
||||||
Once you've installed the JavaScript client library, you're ready to [write data](/influxdb/v2/api-guide/client-libraries/nodejs/write/) to InfluxDB or [get started](#get-started-with-examples) with other examples from the client library.
|
Once you've installed the JavaScript client library, you're ready to [write data](/influxdb/version/api-guide/client-libraries/nodejs/write/) to InfluxDB or [get started](#get-started-with-examples) with other examples from the client library.
|
||||||
|
|
||||||
## Get started with examples
|
## Get started with examples
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ The client examples include an [`env`](https://github.com/influxdata/influxdb-cl
|
||||||
The examples use these properties to interact with the InfluxDB API.
|
The examples use these properties to interact with the InfluxDB API.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
1. Set environment variables or update `env.mjs` with your InfluxDB [bucket](/influxdb/v2/admin/buckets/), [organization](/influxdb/v2/admin/organizations/), [token](/influxdb/v2/admin/tokens/), and [URL](/influxdb/v2/reference/urls/).
|
1. Set environment variables or update `env.mjs` with your InfluxDB [bucket](/influxdb/version/admin/buckets/), [organization](/influxdb/version/admin/organizations/), [token](/influxdb/version/admin/tokens/), and [URL](/influxdb/version/reference/urls/).
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
export INFLUX_URL=http://localhost:8086
|
export INFLUX_URL=http://localhost:8086
|
||||||
|
|
|
@ -5,7 +5,7 @@ The following example sends a Flux query to an InfluxDB bucket and outputs rows
|
||||||
|
|
||||||
## Before you begin
|
## Before you begin
|
||||||
|
|
||||||
- [Install the client library and other dependencies](/influxdb/v2/api-guide/client-libraries/nodejs/install/).
|
- [Install the client library and other dependencies](/influxdb/version/api-guide/client-libraries/nodejs/install/).
|
||||||
|
|
||||||
## Query InfluxDB
|
## Query InfluxDB
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ The following example sends a Flux query to an InfluxDB bucket and outputs rows
|
||||||
|
|
||||||
4. Use the `queryRows()` method of the query client to query InfluxDB.
|
4. Use the `queryRows()` method of the query client to query InfluxDB.
|
||||||
`queryRows()` takes a Flux query and an [RxJS **Observer**](http://reactivex.io/rxjs/manual/overview.html#observer) object.
|
`queryRows()` takes a Flux query and an [RxJS **Observer**](http://reactivex.io/rxjs/manual/overview.html#observer) object.
|
||||||
The client returns [table](/influxdb/v2/reference/syntax/annotated-csv/#tables) metadata and rows as an [RxJS **Observable**](http://reactivex.io/rxjs/manual/overview.html#observable).
|
The client returns [table](/influxdb/version/reference/syntax/annotated-csv/#tables) metadata and rows as an [RxJS **Observable**](http://reactivex.io/rxjs/manual/overview.html#observable).
|
||||||
`queryRows()` subscribes your observer to the observable.
|
`queryRows()` subscribes your observer to the observable.
|
||||||
Finally, the observer logs the rows from the response to the terminal.
|
Finally, the observer logs the rows from the response to the terminal.
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ The JavaScript client library includes the following convenient features for wri
|
||||||
|
|
||||||
### Before you begin
|
### Before you begin
|
||||||
|
|
||||||
- [Install the client library and other dependencies](/influxdb/v2/api-guide/client-libraries/nodejs/install/).
|
- [Install the client library and other dependencies](/influxdb/version/api-guide/client-libraries/nodejs/install/).
|
||||||
### Write data with the client library
|
### Write data with the client library
|
||||||
|
|
||||||
1. Instantiate an `InfluxDB` client. Provide your InfluxDB URL and API token.
|
1. Instantiate an `InfluxDB` client. Provide your InfluxDB URL and API token.
|
||||||
|
@ -33,15 +33,15 @@ The JavaScript client library includes the following convenient features for wri
|
||||||
- *`YOUR_ORG`*: InfluxDB organization ID
|
- *`YOUR_ORG`*: InfluxDB organization ID
|
||||||
- *`YOUR_BUCKET`*: InfluxDB bucket name
|
- *`YOUR_BUCKET`*: InfluxDB bucket name
|
||||||
|
|
||||||
3. To apply one or more [tags](/influxdb/v2/reference/glossary/#tag) to all points, use the `useDefaultTags()` method.
|
3. To apply one or more [tags](/influxdb/version/reference/glossary/#tag) to all points, use the `useDefaultTags()` method.
|
||||||
Provide tags as an object of key/value pairs.
|
Provide tags as an object of key/value pairs.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
writeApi.useDefaultTags({region: 'west'})
|
writeApi.useDefaultTags({region: 'west'})
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Use the `Point()` constructor to create a [point](/influxdb/v2/reference/glossary/#point).
|
4. Use the `Point()` constructor to create a [point](/influxdb/version/reference/glossary/#point).
|
||||||
1. Call the constructor and provide a [measurement](/influxdb/v2/reference/glossary/#measurement).
|
1. Call the constructor and provide a [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
2. To add one or more tags, chain the `tag()` method to the constructor.
|
2. To add one or more tags, chain the `tag()` method to the constructor.
|
||||||
Provide a `name` and `value`.
|
Provide a `name` and `value`.
|
||||||
3. To add a field of type `float`, chain the `floatField()` method to the constructor.
|
3. To add a field of type `float`, chain the `floatField()` method to the constructor.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Use the [InfluxDB Python client library](https://github.com/influxdata/influxdb-client-python) to integrate InfluxDB into Python scripts and applications.
|
Use the [InfluxDB Python client library](https://github.com/influxdata/influxdb-client-python) to integrate InfluxDB into Python scripts and applications.
|
||||||
|
|
||||||
This guide presumes some familiarity with Python and InfluxDB.
|
This guide presumes some familiarity with Python and InfluxDB.
|
||||||
If just getting started, see [Get started with InfluxDB](/influxdb/v2/get-started/).
|
If just getting started, see [Get started with InfluxDB](/influxdb/version/get-started/).
|
||||||
|
|
||||||
## Before you begin
|
## Before you begin
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ If just getting started, see [Get started with InfluxDB](/influxdb/v2/get-starte
|
||||||
|
|
||||||
## Write data to InfluxDB with Python
|
## Write data to InfluxDB with Python
|
||||||
|
|
||||||
We are going to write some data in [line protocol](/influxdb/v2/reference/syntax/line-protocol/) using the Python library.
|
We are going to write some data in [line protocol](/influxdb/version/reference/syntax/line-protocol/) using the Python library.
|
||||||
|
|
||||||
1. In your Python program, import the InfluxDB client library and use it to write data to InfluxDB.
|
1. In your Python program, import the InfluxDB client library and use it to write data to InfluxDB.
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ We are going to write some data in [line protocol](/influxdb/v2/reference/syntax
|
||||||
from influxdb_client.client.write_api import SYNCHRONOUS
|
from influxdb_client.client.write_api import SYNCHRONOUS
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Define a few variables with the name of your [bucket](/influxdb/v2/admin/buckets/), [organization](/influxdb/v2/admin/organizations/), and [token](/influxdb/v2/admin/tokens/).
|
2. Define a few variables with the name of your [bucket](/influxdb/version/admin/buckets/), [organization](/influxdb/version/admin/organizations/), and [token](/influxdb/version/admin/tokens/).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
bucket = "<my-bucket>"
|
bucket = "<my-bucket>"
|
||||||
|
@ -55,7 +55,7 @@ We are going to write some data in [line protocol](/influxdb/v2/reference/syntax
|
||||||
write_api = client.write_api(write_options=SYNCHRONOUS)
|
write_api = client.write_api(write_options=SYNCHRONOUS)
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Create a [point](/influxdb/v2/reference/glossary/#point) object and write it to InfluxDB using the `write` method of the API writer object. The write method requires three parameters: `bucket`, `org`, and `record`.
|
5. Create a [point](/influxdb/version/reference/glossary/#point) object and write it to InfluxDB using the `write` method of the API writer object. The write method requires three parameters: `bucket`, `org`, and `record`.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
p = influxdb_client.Point("my_measurement").tag("location", "Prague").field("temperature", 25.3)
|
p = influxdb_client.Point("my_measurement").tag("location", "Prague").field("temperature", 25.3)
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
The InfluxDB v2 API includes InfluxDB 1.x compatibility endpoints that work with
|
The InfluxDB v2 API includes InfluxDB 1.x compatibility endpoints that work with
|
||||||
InfluxDB 1.x client libraries and third-party integrations like [Grafana](https://grafana.com) and others.
|
InfluxDB 1.x client libraries and third-party integrations like [Grafana](https://grafana.com) and others.
|
||||||
|
|
||||||
<a class="btn" href="/influxdb/v2/api/v1-compatibility/">View full v1 compatibility API documentation</a>
|
<a class="btn" href="/influxdb/version/api/v1-compatibility/">View full v1 compatibility API documentation</a>
|
||||||
|
|
||||||
## Authentication
|
## Authentication
|
||||||
|
|
||||||
InfluxDB 1.x compatibility endpoints require all query and write requests to be authenticated with an
|
InfluxDB 1.x compatibility endpoints require all query and write requests to be authenticated with an
|
||||||
[API token](/influxdb/v2/admin/tokens/) or 1.x-compatible
|
[API token](/influxdb/version/admin/tokens/) or 1.x-compatible
|
||||||
credentials.
|
credentials.
|
||||||
|
|
||||||
* [Authenticate with the Token scheme](#authenticate-with-the-token-scheme)
|
* [Authenticate with the Token scheme](#authenticate-with-the-token-scheme)
|
||||||
|
@ -16,7 +16,7 @@ credentials.
|
||||||
### Authenticate with the Token scheme
|
### Authenticate with the Token scheme
|
||||||
Token authentication requires the following credential:
|
Token authentication requires the following credential:
|
||||||
|
|
||||||
- **token**: InfluxDB [API token](/influxdb/v2/admin/tokens/)
|
- **token**: InfluxDB [API token](/influxdb/version/admin/tokens/)
|
||||||
|
|
||||||
Use the `Authorization` header with the `Token` scheme to provide your token to InfluxDB.
|
Use the `Authorization` header with the `Token` scheme to provide your token to InfluxDB.
|
||||||
The `Token` scheme is the word `Token`, a space, and your token (all case-sensitive).
|
The `Token` scheme is the word `Token`, a space, and your token (all case-sensitive).
|
||||||
|
@ -67,12 +67,12 @@ Username and password schemes require the following credentials:
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
#### Password or Token
|
#### Password or Token
|
||||||
|
|
||||||
If you have [set a password](/influxdb/v2/install/upgrade/v1-to-v2/manual-upgrade/#1x-compatible-authorizations) for the 1.x-compatible username, provide the 1.x-compatible password.
|
If you have [set a password](/influxdb/version/install/upgrade/v1-to-v2/manual-upgrade/#1x-compatible-authorizations) for the 1.x-compatible username, provide the 1.x-compatible password.
|
||||||
If you haven't set a password for the 1.x-compatible username, provide the InfluxDB [authentication token](/influxdb/v2/admin/tokens/) as the password.
|
If you haven't set a password for the 1.x-compatible username, provide the InfluxDB [authentication token](/influxdb/version/admin/tokens/) as the password.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
For more information, see how to create and manage
|
For more information, see how to create and manage
|
||||||
[1.x-compatible authorizations](/influxdb/v2/install/upgrade/v1-to-v2/manual-upgrade/#1x-compatible-authorizations)
|
[1.x-compatible authorizations](/influxdb/version/install/upgrade/v1-to-v2/manual-upgrade/#1x-compatible-authorizations)
|
||||||
when manually upgrading from InfluxDB v1 to v2.
|
when manually upgrading from InfluxDB v1 to v2.
|
||||||
|
|
||||||
{{% /show-in %}}
|
{{% /show-in %}}
|
||||||
|
|
|
@ -26,10 +26,10 @@ If you haven't already, [create an InfluxDB Cloud account](https://www.influxdat
|
||||||
|
|
||||||
The IoT Starter example app assumes the following prerequisites:
|
The IoT Starter example app assumes the following prerequisites:
|
||||||
|
|
||||||
- An InfluxDB [org ID](/influxdb/v2/admin/organizations/view-orgs/)
|
- An InfluxDB [org ID](/influxdb/version/admin/organizations/view-orgs/)
|
||||||
- An [API token](/influxdb/v2/admin/tokens/create-token/) (for example, an **All Access token**) that has read and write permissions for the buckets
|
- An [API token](/influxdb/version/admin/tokens/create-token/) (for example, an **All Access token**) that has read and write permissions for the buckets
|
||||||
- A [bucket](/influxdb/v2/admin/buckets/create-bucket/#create-a-bucket-using-the-influxdb-api) named `iot_center` for storing time series data from devices
|
- A [bucket](/influxdb/version/admin/buckets/create-bucket/#create-a-bucket-using-the-influxdb-api) named `iot_center` for storing time series data from devices
|
||||||
- A [bucket](/influxdb/v2/admin/buckets/create-bucket/#create-a-bucket-using-the-influxdb-api) named `iot_center_devices` for storing device metadata and API token IDs
|
- A [bucket](/influxdb/version/admin/buckets/create-bucket/#create-a-bucket-using-the-influxdb-api) named `iot_center_devices` for storing device metadata and API token IDs
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ To learn more, see [Next.js dynamic API routes](https://nextjs.org/docs/api-rout
|
||||||
|
|
||||||
Retrieve registered devices in `INFLUX_BUCKET_AUTH` and process the query results.
|
Retrieve registered devices in `INFLUX_BUCKET_AUTH` and process the query results.
|
||||||
|
|
||||||
1. Create a Flux query that gets the last row of each [series](/influxdb/v2/reference/glossary#series) that contains a `deviceauth` measurement.
|
1. Create a Flux query that gets the last row of each [series](/influxdb/version/reference/glossary#series) that contains a `deviceauth` measurement.
|
||||||
The example query below returns rows that contain the `key` field (authorization ID) and excludes rows that contain a `token` field (to avoid exposing tokens to the UI).
|
The example query below returns rows that contain the `key` field (authorization ID) and excludes rows that contain a `token` field (to avoid exposing tokens to the UI).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -310,7 +310,7 @@ In this application, a _registered device_ is a point that contains your device
|
||||||
The API token and authorization permissions allow the device to query and write to `INFLUX_BUCKET`.
|
The API token and authorization permissions allow the device to query and write to `INFLUX_BUCKET`.
|
||||||
In this section, you add the API endpoint that handles requests from the UI, creates an authorization in InfluxDB,
|
In this section, you add the API endpoint that handles requests from the UI, creates an authorization in InfluxDB,
|
||||||
and writes the registered device to the `INFLUX_BUCKET_AUTH` bucket.
|
and writes the registered device to the `INFLUX_BUCKET_AUTH` bucket.
|
||||||
To learn more about API tokens and authorizations, see [Manage API tokens](/influxdb/v2/admin/tokens/)
|
To learn more about API tokens and authorizations, see [Manage API tokens](/influxdb/version/admin/tokens/)
|
||||||
|
|
||||||
The application API uses the following `/api/v2` InfluxDB API endpoints:
|
The application API uses the following `/api/v2` InfluxDB API endpoints:
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ the `/api/v2/buckets` InfluxDB API endpoint.
|
||||||
- Description: `IoTCenterDevice: DEVICE_ID`.
|
- Description: `IoTCenterDevice: DEVICE_ID`.
|
||||||
- List of permissions to the bucket.
|
- List of permissions to the bucket.
|
||||||
|
|
||||||
To learn more about API tokens and authorizations, see [Manage API tokens](/influxdb/v2/admin/tokens/).
|
To learn more about API tokens and authorizations, see [Manage API tokens](/influxdb/version/admin/tokens/).
|
||||||
|
|
||||||
Next, [write the device authorization to a bucket](#write-the-device-authorization-to-a-bucket).
|
Next, [write the device authorization to a bucket](#write-the-device-authorization-to-a-bucket).
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,10 @@ If you haven't already, [create an InfluxDB Cloud account](https://www.influxdat
|
||||||
|
|
||||||
The IoT Starter example app assumes the following prerequisites:
|
The IoT Starter example app assumes the following prerequisites:
|
||||||
|
|
||||||
- An InfluxDB [org ID](/influxdb/v2/admin/organizations/view-orgs/)
|
- An InfluxDB [org ID](/influxdb/version/admin/organizations/view-orgs/)
|
||||||
- An [API token](/influxdb/v2/admin/tokens/create-token/) (for example, an **All Access token**) that has read and write permissions for the buckets
|
- An [API token](/influxdb/version/admin/tokens/create-token/) (for example, an **All Access token**) that has read and write permissions for the buckets
|
||||||
- A [bucket](/influxdb/v2/admin/buckets/create-bucket/#create-a-bucket-using-the-influxdb-api) named `iot_center` for storing time series data from devices
|
- A [bucket](/influxdb/version/admin/buckets/create-bucket/#create-a-bucket-using-the-influxdb-api) named `iot_center` for storing time series data from devices
|
||||||
- A [bucket](/influxdb/v2/admin/buckets/create-bucket/#create-a-bucket-using-the-influxdb-api) named `iot_center_devices` for storing device metadata and API token IDs
|
- A [bucket](/influxdb/version/admin/buckets/create-bucket/#create-a-bucket-using-the-influxdb-api) named `iot_center_devices` for storing device metadata and API token IDs
|
||||||
|
|
||||||
## Introducing IoT Starter
|
## Introducing IoT Starter
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ In this application, a _registered device_ is a point that contains your device
|
||||||
The API token and authorization permissions allow the device to query and write to `INFLUX_BUCKET`.
|
The API token and authorization permissions allow the device to query and write to `INFLUX_BUCKET`.
|
||||||
In this section, you add the API endpoint that handles requests from the UI, creates an authorization in InfluxDB,
|
In this section, you add the API endpoint that handles requests from the UI, creates an authorization in InfluxDB,
|
||||||
and writes the registered device to the `INFLUX_BUCKET_AUTH` bucket.
|
and writes the registered device to the `INFLUX_BUCKET_AUTH` bucket.
|
||||||
To learn more about API tokens and authorizations, see [Manage API tokens](/influxdb/v2/admin/tokens/)
|
To learn more about API tokens and authorizations, see [Manage API tokens](/influxdb/version/admin/tokens/)
|
||||||
|
|
||||||
The application API uses the following `/api/v2` InfluxDB API endpoints:
|
The application API uses the following `/api/v2` InfluxDB API endpoints:
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ the `/api/v2/buckets` InfluxDB API endpoint.
|
||||||
- Description: `IoTCenterDevice: DEVICE_ID`.
|
- Description: `IoTCenterDevice: DEVICE_ID`.
|
||||||
- List of permissions to the bucket.
|
- List of permissions to the bucket.
|
||||||
|
|
||||||
To learn more about API tokens and authorizations, see [Manage API tokens](/influxdb/v2/admin/tokens/).
|
To learn more about API tokens and authorizations, see [Manage API tokens](/influxdb/version/admin/tokens/).
|
||||||
|
|
||||||
Next, [write the device authorization to a bucket](#write-the-device-authorization-to-a-bucket).
|
Next, [write the device authorization to a bucket](#write-the-device-authorization-to-a-bucket).
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ Next, [create the API to list devices](#create-the-api-to-list-devices).
|
||||||
|
|
||||||
Add the `/api/devices` API endpoint that retrieves, processes, and lists registered devices.
|
Add the `/api/devices` API endpoint that retrieves, processes, and lists registered devices.
|
||||||
|
|
||||||
1. Create a Flux query that gets the last row of each [series](/influxdb/v2/reference/glossary#series) that contains a `deviceauth` measurement.
|
1. Create a Flux query that gets the last row of each [series](/influxdb/version/reference/glossary#series) that contains a `deviceauth` measurement.
|
||||||
The example query below returns rows that contain the `key` field (authorization ID) and excludes rows that contain a `token` field (to avoid exposing tokens to the UI).
|
The example query below returns rows that contain the `key` field (authorization ID) and excludes rows that contain a `token` field (to avoid exposing tokens to the UI).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
Now that you know the [basics of querying data from InfluxDB](/influxdb/v2/get-started/query/),
|
Now that you know the [basics of querying data from InfluxDB](/influxdb/version/get-started/query/),
|
||||||
let's go beyond a basic query and begin to process the queried data.
|
let's go beyond a basic query and begin to process the queried data.
|
||||||
"Processing" data could mean transforming, aggregating, downsampling, or alerting
|
"Processing" data could mean transforming, aggregating, downsampling, or alerting
|
||||||
on data. This tutorial covers the following data processing use cases:
|
on data. This tutorial covers the following data processing use cases:
|
||||||
|
@ -102,7 +102,7 @@ from(bucket: "get-started")
|
||||||
{{% expand "Perform mathematical operations" %}}
|
{{% expand "Perform mathematical operations" %}}
|
||||||
|
|
||||||
`map()` lets your perform mathematical operations on your data.
|
`map()` lets your perform mathematical operations on your data.
|
||||||
For example, using the [data written in "Get started writing to InfluxDB"](/influxdb/v2/get-started/write/#view-the-written-data):
|
For example, using the [data written in "Get started writing to InfluxDB"](/influxdb/version/get-started/write/#view-the-written-data):
|
||||||
|
|
||||||
1. Query the `temp` field to return room temperatures in °C.
|
1. Query the `temp` field to return room temperatures in °C.
|
||||||
2. Use `map()` to iterate over each row and convert the °C temperatures in the
|
2. Use `map()` to iterate over each row and convert the °C temperatures in the
|
||||||
|
@ -183,7 +183,7 @@ from(bucket: "get-started")
|
||||||
{{% expand "Conditionally assign a state" %}}
|
{{% expand "Conditionally assign a state" %}}
|
||||||
|
|
||||||
Within a `map()` function, you can use [conditional expressions](/flux/v0/spec/expressions/#conditional-expressions) (if/then/else) to conditionally assign values.
|
Within a `map()` function, you can use [conditional expressions](/flux/v0/spec/expressions/#conditional-expressions) (if/then/else) to conditionally assign values.
|
||||||
For example, using the [data written in "Get started writing to InfluxDB"](/influxdb/v2/get-started/write/#view-the-written-data):
|
For example, using the [data written in "Get started writing to InfluxDB"](/influxdb/version/get-started/write/#view-the-written-data):
|
||||||
|
|
||||||
1. Query the `co` field to return carbon monoxide parts per million (ppm) readings in each room.
|
1. Query the `co` field to return carbon monoxide parts per million (ppm) readings in each room.
|
||||||
2. Use `map()` to iterate over each row, evaluate the value in the `_value`
|
2. Use `map()` to iterate over each row, evaluate the value in the `_value`
|
||||||
|
@ -278,7 +278,7 @@ For this example to actually send messages to Slack, you need to
|
||||||
[set up a Slack app that can send and receive messages](https://api.slack.com/messaging/sending).
|
[set up a Slack app that can send and receive messages](https://api.slack.com/messaging/sending).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
For example, using the [data written in "Get started writing to InfluxDB"](/influxdb/v2/get-started/write/#view-the-written-data):
|
For example, using the [data written in "Get started writing to InfluxDB"](/influxdb/version/get-started/write/#view-the-written-data):
|
||||||
|
|
||||||
1. Import the [`slack` package](/flux/v0/stdlib/slack/).
|
1. Import the [`slack` package](/flux/v0/stdlib/slack/).
|
||||||
2. Query the `co` field to return carbon monoxide parts per million (ppm) readings in each room.
|
2. Query the `co` field to return carbon monoxide parts per million (ppm) readings in each room.
|
||||||
|
@ -384,7 +384,7 @@ With the results above, you would receive the following messages in Slack:
|
||||||
> Carbon monoxide is at dangerous levels in the Living Room: 17 ppm.
|
> Carbon monoxide is at dangerous levels in the Living Room: 17 ppm.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
You can also use the [InfluxDB checks and notifications system](/influxdb/v2/monitor-alert/)
|
You can also use the [InfluxDB checks and notifications system](/influxdb/version/monitor-alert/)
|
||||||
as a user interface for configuring checks and alerting on data.
|
as a user interface for configuring checks and alerting on data.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ This grouping is important as you [aggregate data](#aggregate-or-select-specific
|
||||||
{{< expand-wrapper >}}
|
{{< expand-wrapper >}}
|
||||||
{{% expand "Group data by specific columns" %}}
|
{{% expand "Group data by specific columns" %}}
|
||||||
|
|
||||||
Using the [data written in "Get started writing to InfluxDB"](/influxdb/v2/get-started/write/#view-the-written-data):
|
Using the [data written in "Get started writing to InfluxDB"](/influxdb/version/get-started/write/#view-the-written-data):
|
||||||
|
|
||||||
1. Query the `temp` and `hum` fields.
|
1. Query the `temp` and `hum` fields.
|
||||||
2. Use `group()` to group by only the `_field` column.
|
2. Use `group()` to group by only the `_field` column.
|
||||||
|
@ -520,7 +520,7 @@ and all the rows with the `hum` field will be in another.
|
||||||
|
|
||||||
{{% expand "Ungroup data" %}}
|
{{% expand "Ungroup data" %}}
|
||||||
|
|
||||||
Using the [data written in "Get started writing to InfluxDB"](/influxdb/v2/get-started/write/#view-the-written-data):
|
Using the [data written in "Get started writing to InfluxDB"](/influxdb/version/get-started/write/#view-the-written-data):
|
||||||
|
|
||||||
1. Query the `temp` and `hum` fields.
|
1. Query the `temp` and `hum` fields.
|
||||||
2. Use `group()` without any parameters to "ungroup" data or group by no columns.
|
2. Use `group()` without any parameters to "ungroup" data or group by no columns.
|
||||||
|
@ -645,7 +645,7 @@ and return a single row for each input table with the aggregate value of that ta
|
||||||
|
|
||||||
{{% expand "Calculate the average temperature for each room" %}}
|
{{% expand "Calculate the average temperature for each room" %}}
|
||||||
|
|
||||||
Using the [data written in "Get started writing to InfluxDB"](/influxdb/v2/get-started/write/#view-the-written-data):
|
Using the [data written in "Get started writing to InfluxDB"](/influxdb/version/get-started/write/#view-the-written-data):
|
||||||
|
|
||||||
1. Query the `temp` field. By default, `from()` returns the data grouped by
|
1. Query the `temp` field. By default, `from()` returns the data grouped by
|
||||||
`_measurement`, `room` and `_field`, so each table represents a room.
|
`_measurement`, `room` and `_field`, so each table represents a room.
|
||||||
|
@ -713,7 +713,7 @@ from(bucket: "get-started")
|
||||||
|
|
||||||
{{% expand "Calculate the overall average temperature of all rooms" %}}
|
{{% expand "Calculate the overall average temperature of all rooms" %}}
|
||||||
|
|
||||||
Using the [data written in "Get started writing to InfluxDB"](/influxdb/v2/get-started/write/#view-the-written-data):
|
Using the [data written in "Get started writing to InfluxDB"](/influxdb/version/get-started/write/#view-the-written-data):
|
||||||
|
|
||||||
1. Query the `temp` field.
|
1. Query the `temp` field.
|
||||||
2. Use `group()` to **ungroup** the data into a single table. By default,
|
2. Use `group()` to **ungroup** the data into a single table. By default,
|
||||||
|
@ -780,7 +780,7 @@ into `mean()`.
|
||||||
|
|
||||||
{{% expand "Count the number of points reported per room across all fields" %}}
|
{{% expand "Count the number of points reported per room across all fields" %}}
|
||||||
|
|
||||||
Using the [data written in "Get started writing to InfluxDB"](/influxdb/v2/get-started/write/#view-the-written-data):
|
Using the [data written in "Get started writing to InfluxDB"](/influxdb/version/get-started/write/#view-the-written-data):
|
||||||
|
|
||||||
1. Query all fields by simply filtering by the `home` measurement.
|
1. Query all fields by simply filtering by the `home` measurement.
|
||||||
2. The fields in the `home` measurement are different types.
|
2. The fields in the `home` measurement are different types.
|
||||||
|
@ -844,7 +844,7 @@ one or more columns from each input table and retain all columns and their value
|
||||||
|
|
||||||
{{% expand "Return the first temperature from each room" %}}
|
{{% expand "Return the first temperature from each room" %}}
|
||||||
|
|
||||||
Using the [data written in "Get started writing to InfluxDB"](/influxdb/v2/get-started/write/#view-the-written-data):
|
Using the [data written in "Get started writing to InfluxDB"](/influxdb/version/get-started/write/#view-the-written-data):
|
||||||
|
|
||||||
1. Query the `temp` field.
|
1. Query the `temp` field.
|
||||||
2. Use [`first()`](/flux/v0/stdlib/universe/first/) to return the
|
2. Use [`first()`](/flux/v0/stdlib/universe/first/) to return the
|
||||||
|
@ -912,7 +912,7 @@ from(bucket: "get-started")
|
||||||
|
|
||||||
{{% expand "Return the last temperature from each room" %}}
|
{{% expand "Return the last temperature from each room" %}}
|
||||||
|
|
||||||
Using the [data written in "Get started writing to InfluxDB"](/influxdb/v2/get-started/write/#view-the-written-data):
|
Using the [data written in "Get started writing to InfluxDB"](/influxdb/version/get-started/write/#view-the-written-data):
|
||||||
|
|
||||||
1. Query the `temp` field.
|
1. Query the `temp` field.
|
||||||
2. Use [`last()`](/flux/v0/stdlib/universe/last/) to return the
|
2. Use [`last()`](/flux/v0/stdlib/universe/last/) to return the
|
||||||
|
@ -980,7 +980,7 @@ from(bucket: "get-started")
|
||||||
|
|
||||||
{{% expand "Return the maximum temperature from each room" %}}
|
{{% expand "Return the maximum temperature from each room" %}}
|
||||||
|
|
||||||
Using the [data written in "Get started writing to InfluxDB"](/influxdb/v2/get-started/write/#view-the-written-data):
|
Using the [data written in "Get started writing to InfluxDB"](/influxdb/version/get-started/write/#view-the-written-data):
|
||||||
|
|
||||||
1. Query the `temp` field.
|
1. Query the `temp` field.
|
||||||
2. Use [`max()`](/flux/v0/stdlib/universe/max/) to return the row
|
2. Use [`max()`](/flux/v0/stdlib/universe/max/) to return the row
|
||||||
|
@ -1142,7 +1142,7 @@ optimizes long-term data storage. Simply put, downsampling reduces the number of
|
||||||
points returned by a query without losing the general trends in the data.
|
points returned by a query without losing the general trends in the data.
|
||||||
|
|
||||||
_For more information about downsampling data, see
|
_For more information about downsampling data, see
|
||||||
[Downsample data](/influxdb/v2/process-data/common-tasks/downsample-data/)._
|
[Downsample data](/influxdb/version/process-data/common-tasks/downsample-data/)._
|
||||||
|
|
||||||
The most common way to downsample data is by time intervals or "windows."
|
The most common way to downsample data is by time intervals or "windows."
|
||||||
For example, you may want to query the last hour of data and return the average
|
For example, you may want to query the last hour of data and return the average
|
||||||
|
@ -1231,13 +1231,13 @@ from(bucket: "get-started")
|
||||||
|
|
||||||
## Automate processing with InfluxDB tasks
|
## Automate processing with InfluxDB tasks
|
||||||
|
|
||||||
[InfluxDB tasks](/influxdb/v2/process-data/get-started/) are scheduled queries
|
[InfluxDB tasks](/influxdb/version/process-data/get-started/) are scheduled queries
|
||||||
that can perform any of the data processing operations described above.
|
that can perform any of the data processing operations described above.
|
||||||
Generally tasks then use the [`to()` function](/flux/v0/stdlib/influxdata/influxdb/to/)
|
Generally tasks then use the [`to()` function](/flux/v0/stdlib/influxdata/influxdb/to/)
|
||||||
to write the processed result back to InfluxDB.
|
to write the processed result back to InfluxDB.
|
||||||
|
|
||||||
_For more information about creating and configuring tasks, see
|
_For more information about creating and configuring tasks, see
|
||||||
[Get started with InfluxDB tasks](/influxdb/v2/process-data/get-started/)._
|
[Get started with InfluxDB tasks](/influxdb/version/process-data/get-started/)._
|
||||||
|
|
||||||
#### Example downsampling task
|
#### Example downsampling task
|
||||||
|
|
||||||
|
@ -1252,4 +1252,4 @@ from(bucket: "get-started-downsampled")
|
||||||
|> filter(fn: (r) => r._measurement == "home")
|
|> filter(fn: (r) => r._measurement == "home")
|
||||||
|> aggregateWindow(every: 2h, fn: mean)
|
|> aggregateWindow(every: 2h, fn: mean)
|
||||||
```
|
```
|
||||||
{{< page-nav prev="/influxdb/v2/get-started/query/" next="/influxdb/v2/get-started/visualize/" keepTab=true >}}
|
{{< page-nav prev="/influxdb/version/get-started/query/" next="/influxdb/version/get-started/visualize/" keepTab=true >}}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
InfluxDB supports many different tools for querying data, including:
|
InfluxDB supports many different tools for querying data, including:
|
||||||
|
|
||||||
- InfluxDB user interface (UI)
|
- InfluxDB user interface (UI)
|
||||||
- [InfluxDB HTTP API](/influxdb/v2/reference/api/)
|
- [InfluxDB HTTP API](/influxdb/version/reference/api/)
|
||||||
- [`influx` CLI](/influxdb/v2/tools/influx-cli/)
|
- [`influx` CLI](/influxdb/version/tools/influx-cli/)
|
||||||
- [Chronograf](/chronograf/v1/)
|
- [Chronograf](/chronograf/v1/)
|
||||||
- [Grafana](/influxdb/v2/tools/grafana/)
|
- [Grafana](/influxdb/version/tools/grafana/)
|
||||||
- [InfluxDB client libraries](/influxdb/v2/api-guide/client-libraries/)
|
- [InfluxDB client libraries](/influxdb/version/api-guide/client-libraries/)
|
||||||
|
|
||||||
This tutorial walks you through the fundamentals of querying data in InfluxDB and
|
This tutorial walks you through the fundamentals of querying data in InfluxDB and
|
||||||
focuses primarily on the two languages you can use to query your time series data:
|
focuses primarily on the two languages you can use to query your time series data:
|
||||||
|
@ -18,7 +18,7 @@ focuses primarily on the two languages you can use to query your time series dat
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
The examples in this section of the tutorial query the data from written in the
|
The examples in this section of the tutorial query the data from written in the
|
||||||
[Get started writing data](/influxdb/v2/get-started/write/#write-line-protocol-to-influxdb) section.
|
[Get started writing data](/influxdb/version/get-started/write/#write-line-protocol-to-influxdb) section.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
###### On this page:
|
###### On this page:
|
||||||
|
@ -56,7 +56,7 @@ When querying InfluxDB with Flux, there are three primary functions you use:
|
||||||
You can apply multiple subsequent filters.
|
You can apply multiple subsequent filters.
|
||||||
|
|
||||||
To see how `from()` structures data into rows and tables when returned from InfluxDB,
|
To see how `from()` structures data into rows and tables when returned from InfluxDB,
|
||||||
[view the data written in Get started writing to InfluxDB](/influxdb/v2/get-started/write/#view-the-written-data).
|
[view the data written in Get started writing to InfluxDB](/influxdb/version/get-started/write/#view-the-written-data).
|
||||||
|
|
||||||
{{< expand-wrapper >}}
|
{{< expand-wrapper >}}
|
||||||
{{% expand "Learn more about how `filter()` works" %}}
|
{{% expand "Learn more about how `filter()` works" %}}
|
||||||
|
@ -228,14 +228,14 @@ Use the **InfluxDB UI**, **`influx` CLI**, or **InfluxDB API** to execute Flux q
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
<!-------------------------- BEGIN FLUX CLI CONTENT --------------------------->
|
<!-------------------------- BEGIN FLUX CLI CONTENT --------------------------->
|
||||||
|
|
||||||
1. If you haven't already, [download, install, and configure the `influx` CLI](/influxdb/v2/tools/influx-cli/).
|
1. If you haven't already, [download, install, and configure the `influx` CLI](/influxdb/version/tools/influx-cli/).
|
||||||
2. Use the [`influx query` command](/influxdb/v2/reference/cli/influx/query/)
|
2. Use the [`influx query` command](/influxdb/version/reference/cli/influx/query/)
|
||||||
to query InfluxDB using Flux.
|
to query InfluxDB using Flux.
|
||||||
|
|
||||||
**Provide the following**:
|
**Provide the following**:
|
||||||
|
|
||||||
- String-encoded Flux query.
|
- String-encoded Flux query.
|
||||||
- [Connection and authentication credentials](/influxdb/v2/get-started/setup/?t=influx+CLI#configure-authentication-credentials)
|
- [Connection and authentication credentials](/influxdb/version/get-started/setup/?t=influx+CLI#configure-authentication-credentials)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influx query '
|
influx query '
|
||||||
|
@ -252,10 +252,10 @@ from(bucket: "get-started")
|
||||||
<!-------------------------- BEGIN FLUX API CONTENT --------------------------->
|
<!-------------------------- BEGIN FLUX API CONTENT --------------------------->
|
||||||
|
|
||||||
To query data from InfluxDB using Flux and the InfluxDB HTTP API, send a request
|
To query data from InfluxDB using Flux and the InfluxDB HTTP API, send a request
|
||||||
to the InfluxDB API [`/api/v2/query` endpoint](/influxdb/v2/api/#operation/PostQuery)
|
to the InfluxDB API [`/api/v2/query` endpoint](/influxdb/version/api/#operation/PostQuery)
|
||||||
using the `POST` request method.
|
using the `POST` request method.
|
||||||
|
|
||||||
{{< api-endpoint endpoint="http://localhost:8086/api/v2/query" method="post" api-ref="/influxdb/v2/api/#operation/PostQuery" >}}
|
{{< api-endpoint endpoint="http://localhost:8086/api/v2/query" method="post" api-ref="/influxdb/version/api/#operation/PostQuery" >}}
|
||||||
|
|
||||||
Include the following with your request:
|
Include the following with your request:
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ curl --request POST \
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
The InfluxDB `/api/v2/query` endpoint returns query results in
|
The InfluxDB `/api/v2/query` endpoint returns query results in
|
||||||
[annotated CSV](/influxdb/v2/reference/syntax/annotated-csv/).
|
[annotated CSV](/influxdb/version/reference/syntax/annotated-csv/).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
<!--------------------------- END FLUX API CONTENT ---------------------------->
|
<!--------------------------- END FLUX API CONTENT ---------------------------->
|
||||||
|
@ -411,9 +411,9 @@ specifically designed to query time series data from InfluxDB 0.x and 1.x.
|
||||||
|
|
||||||
Because InfluxQL was developed for earlier versions of InfluxDB, it depends on
|
Because InfluxQL was developed for earlier versions of InfluxDB, it depends on
|
||||||
**databases and retention policies** (DBRP) which have been replaced by
|
**databases and retention policies** (DBRP) which have been replaced by
|
||||||
[buckets](/influxdb/v2/get-started/#data-organization) in InfluxDB {{< current-version >}}.
|
[buckets](/influxdb/version/get-started/#data-organization) in InfluxDB {{< current-version >}}.
|
||||||
To use InfluxQL with InfluxDB {{< current-version >}}, first
|
To use InfluxQL with InfluxDB {{< current-version >}}, first
|
||||||
[map database and retention policy (DBRP) combinations to an InfluxDB bucket](/influxdb/v2/query-data/influxql/dbrp/).
|
[map database and retention policy (DBRP) combinations to an InfluxDB bucket](/influxdb/version/query-data/influxql/dbrp/).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
### InfluxQL query basics
|
### InfluxQL query basics
|
||||||
|
@ -437,7 +437,7 @@ SELECT co,hum,temp,room FROM "get-started".autogen.home WHERE time >= '2022-01-0
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
These are just the fundamentals of the InfluxQL syntax.
|
These are just the fundamentals of the InfluxQL syntax.
|
||||||
For more in-depth information, see the [InfluxQL documentation](/influxdb/v2/query-data/influxql/).
|
For more in-depth information, see the [InfluxQL documentation](/influxdb/version/query-data/influxql/).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
### Execute an InfluxQL query
|
### Execute an InfluxQL query
|
||||||
|
@ -459,8 +459,8 @@ Use the **`influx` CLI**, or **InfluxDB API** to execute InfluxQL queries.
|
||||||
|
|
||||||
The InfluxDB {{< current-version >}} UI does not provide a way to query data with InfluxQL.
|
The InfluxDB {{< current-version >}} UI does not provide a way to query data with InfluxQL.
|
||||||
For a user interface that builds and executes InfluxQL queries, consider using
|
For a user interface that builds and executes InfluxQL queries, consider using
|
||||||
[Chronograf](/influxdb/v2/tools/chronograf/) or
|
[Chronograf](/influxdb/version/tools/chronograf/) or
|
||||||
[Grafana](/influxdb/v2/tools/grafana/) with InfluxDB {{< current-version >}}.
|
[Grafana](/influxdb/version/tools/grafana/) with InfluxDB {{< current-version >}}.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
<!-------------------------- END INFLUXQL UI CONTENT -------------------------->
|
<!-------------------------- END INFLUXQL UI CONTENT -------------------------->
|
||||||
|
@ -470,12 +470,12 @@ For a user interface that builds and executes InfluxQL queries, consider using
|
||||||
|
|
||||||
{{< cli/influx-creds-note >}}
|
{{< cli/influx-creds-note >}}
|
||||||
|
|
||||||
1. If you haven't already, [download, install, and configure the `influx` CLI](/influxdb/v2/tools/influx-cli/).
|
1. If you haven't already, [download, install, and configure the `influx` CLI](/influxdb/version/tools/influx-cli/).
|
||||||
2. Use the [`influx v1 shell` command](/influxdb/v2/reference/cli/influx/v1/shell/)
|
2. Use the [`influx v1 shell` command](/influxdb/version/reference/cli/influx/v1/shell/)
|
||||||
to start an InfluxQL shell and query InfluxDB using InfluxQL.
|
to start an InfluxQL shell and query InfluxDB using InfluxQL.
|
||||||
Provide the following:
|
Provide the following:
|
||||||
|
|
||||||
- [Connection and authentication credentials](/influxdb/v2/get-started/setup/?t=influx+CLI#configure-authentication-credentials)
|
- [Connection and authentication credentials](/influxdb/version/get-started/setup/?t=influx+CLI#configure-authentication-credentials)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influx v1 shell
|
influx v1 shell
|
||||||
|
@ -493,10 +493,10 @@ For a user interface that builds and executes InfluxQL queries, consider using
|
||||||
<!------------------------ BEGIN INFLUXQL API CONTENT ------------------------->
|
<!------------------------ BEGIN INFLUXQL API CONTENT ------------------------->
|
||||||
|
|
||||||
To query data from InfluxDB using InfluxQL and the InfluxDB HTTP API, send a request
|
To query data from InfluxDB using InfluxQL and the InfluxDB HTTP API, send a request
|
||||||
to the InfluxDB API [`/query` 1.X compatibility endpoint](/influxdb/v2/reference/api/influxdb-1x/query/)
|
to the InfluxDB API [`/query` 1.X compatibility endpoint](/influxdb/version/reference/api/influxdb-1x/query/)
|
||||||
using the `POST` request method.
|
using the `POST` request method.
|
||||||
|
|
||||||
{{< api-endpoint endpoint="http://localhost:8086/query" method="post" api-ref="/influxdb/v2/api/v1-compatibility/#operation/PostQueryV1" >}}
|
{{< api-endpoint endpoint="http://localhost:8086/query" method="post" api-ref="/influxdb/version/api/v1-compatibility/#operation/PostQueryV1" >}}
|
||||||
|
|
||||||
Include the following with your request:
|
Include the following with your request:
|
||||||
|
|
||||||
|
@ -509,8 +509,8 @@ Include the following with your request:
|
||||||
- **rp**: Retention policy to query data from.
|
- **rp**: Retention policy to query data from.
|
||||||
- **q**: InfluxQL query to execute.
|
- **q**: InfluxQL query to execute.
|
||||||
- **epoch**: _(Optional)_ Return results with
|
- **epoch**: _(Optional)_ Return results with
|
||||||
[Unix timestamps](/influxdb/v2/reference/glossary/#unix-timestamp) of a
|
[Unix timestamps](/influxdb/version/reference/glossary/#unix-timestamp) of a
|
||||||
specified precision instead of [RFC3339 timestamps](/influxdb/v2/reference/glossary/#rfc3339-timestamp). The following precisions are available:
|
specified precision instead of [RFC3339 timestamps](/influxdb/version/reference/glossary/#rfc3339-timestamp). The following precisions are available:
|
||||||
|
|
||||||
- `ns` - nanoseconds
|
- `ns` - nanoseconds
|
||||||
- `u` or `µ` - microseconds
|
- `u` or `µ` - microseconds
|
||||||
|
@ -578,9 +578,9 @@ The InfluxDB `/write` 1.x compatibility endpoint returns query results in JSON f
|
||||||
|
|
||||||
**Congratulations!** You've learned the basics of querying data in InfluxDB.
|
**Congratulations!** You've learned the basics of querying data in InfluxDB.
|
||||||
For a deep dive into all the ways you can query InfluxDB, see the
|
For a deep dive into all the ways you can query InfluxDB, see the
|
||||||
[Query data in InfluxDB](/influxdb/v2/query-data/) section of documentation.
|
[Query data in InfluxDB](/influxdb/version/query-data/) section of documentation.
|
||||||
|
|
||||||
Let's move on to more advanced data processing queries and automating queries
|
Let's move on to more advanced data processing queries and automating queries
|
||||||
with InfluxDB tasks.
|
with InfluxDB tasks.
|
||||||
|
|
||||||
{{< page-nav prev="/influxdb/v2/get-started/write/" next="/influxdb/v2/get-started/process/" keepTab=true >}}
|
{{< page-nav prev="/influxdb/version/get-started/write/" next="/influxdb/version/get-started/process/" keepTab=true >}}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
|
|
||||||
There are many tools you can use to visualize your time series data including the
|
There are many tools you can use to visualize your time series data including the
|
||||||
InfluxDB user interface (UI), [Chronograf](/influxdb/v2/tools/chronograf/), and
|
InfluxDB user interface (UI), [Chronograf](/influxdb/version/tools/chronograf/), and
|
||||||
[Grafana](/influxdb/v2/tools/grafana/).
|
[Grafana](/influxdb/version/tools/grafana/).
|
||||||
This tutorial walks you through using the **InfluxDB UI** to create a simple dashboard.
|
This tutorial walks you through using the **InfluxDB UI** to create a simple dashboard.
|
||||||
|
|
||||||
Dashboards are a powerful way of displaying time series data and can help to
|
Dashboards are a powerful way of displaying time series data and can help to
|
||||||
identify trends and anomalies. A dashboard is comprised of one or more
|
identify trends and anomalies. A dashboard is comprised of one or more
|
||||||
dashboard cells. A **dashboard cell** visualizes the results of a query using
|
dashboard cells. A **dashboard cell** visualizes the results of a query using
|
||||||
one of the available [visualization types](/influxdb/v2/visualize-data/visualization-types/).
|
one of the available [visualization types](/influxdb/version/visualize-data/visualization-types/).
|
||||||
|
|
||||||
- [Create a dashboard](#create-a-dashboard)
|
- [Create a dashboard](#create-a-dashboard)
|
||||||
- [Create dashboard cells](#create-dashboard-cells)
|
- [Create dashboard cells](#create-dashboard-cells)
|
||||||
|
@ -35,12 +35,12 @@ With your new dashboard created and named, add a new dashboard cell:
|
||||||
2. Click _**Name this Cell**_ and provide a name for the cell.
|
2. Click _**Name this Cell**_ and provide a name for the cell.
|
||||||
For this tutorial, we'll use **"Room temperature"**.
|
For this tutorial, we'll use **"Room temperature"**.
|
||||||
3. _(Optional)_ Select the visualization type from the visualization drop-down menu.
|
3. _(Optional)_ Select the visualization type from the visualization drop-down menu.
|
||||||
There are many different [visualization types](/influxdb/v2/visualize-data/visualization-types/)
|
There are many different [visualization types](/influxdb/version/visualize-data/visualization-types/)
|
||||||
available.
|
available.
|
||||||
For this tutorial, use the default **Graph** visualization.
|
For this tutorial, use the default **Graph** visualization.
|
||||||
4. Use the query time range selector to select an absolute time range that
|
4. Use the query time range selector to select an absolute time range that
|
||||||
covers includes the time range of the
|
covers includes the time range of the
|
||||||
[data written in "Get started writing to InfluxDB"](/influxdb/v2/get-started/write/#view-the-written-data):
|
[data written in "Get started writing to InfluxDB"](/influxdb/version/get-started/write/#view-the-written-data):
|
||||||
**2022-01-01T08:00:00Z** to **2022-01-01T20:00:01Z**.
|
**2022-01-01T08:00:00Z** to **2022-01-01T20:00:01Z**.
|
||||||
|
|
||||||
1. The query time range selector defaults to querying data from the last hour
|
1. The query time range selector defaults to querying data from the last hour
|
||||||
|
@ -80,7 +80,7 @@ With your new dashboard created and named, add a new dashboard cell:
|
||||||
InfluxDB dashboard cells use **dashboard variables** to dynamically change
|
InfluxDB dashboard cells use **dashboard variables** to dynamically change
|
||||||
specific parts of cell queries.
|
specific parts of cell queries.
|
||||||
The query builder automatically builds queries using the following
|
The query builder automatically builds queries using the following
|
||||||
[predefined dashboard variables](/influxdb/v2/visualize-data/variables/#predefined-dashboard-variables),
|
[predefined dashboard variables](/influxdb/version/visualize-data/variables/#predefined-dashboard-variables),
|
||||||
each controlled by selections in your dashboard:
|
each controlled by selections in your dashboard:
|
||||||
|
|
||||||
- `v.timeRangeStart`: Start time of the queried time range specified by the time range selector.
|
- `v.timeRangeStart`: Start time of the queried time range specified by the time range selector.
|
||||||
|
@ -102,9 +102,9 @@ displayed by your dashboard cell.
|
||||||
4. Select the default **Query** dashboard variable type.
|
4. Select the default **Query** dashboard variable type.
|
||||||
This variable type uses the results of a query to populate the list of potential
|
This variable type uses the results of a query to populate the list of potential
|
||||||
variable values. _For information about the other dashboard variable types,
|
variable values. _For information about the other dashboard variable types,
|
||||||
see [Variable types](/influxdb/v2/visualize-data/variables/variable-types/)._
|
see [Variable types](/influxdb/version/visualize-data/variables/variable-types/)._
|
||||||
5. Enter the following Flux query to return all the different `room` tag values
|
5. Enter the following Flux query to return all the different `room` tag values
|
||||||
in your `get-started` bucket from the [Unix epoch](/influxdb/v2/reference/glossary/#unix-timestamp).
|
in your `get-started` bucket from the [Unix epoch](/influxdb/version/reference/glossary/#unix-timestamp).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import "influxdata/influxdb/schema"
|
import "influxdata/influxdb/schema"
|
||||||
|
@ -145,21 +145,21 @@ displayed by your dashboard cell.
|
||||||
{{< img-hd src="/img/influxdb/2-4-get-started-visualize-variable-select.png" alt="InfluxDB dashboard variable selection" />}}
|
{{< img-hd src="/img/influxdb/2-4-get-started-visualize-variable-select.png" alt="InfluxDB dashboard variable selection" />}}
|
||||||
|
|
||||||
_For more information about creating custom dashboard variables, see
|
_For more information about creating custom dashboard variables, see
|
||||||
[Use and manage dashboard variables](/influxdb/v2/visualize-data/variables/)._
|
[Use and manage dashboard variables](/influxdb/version/visualize-data/variables/)._
|
||||||
|
|
||||||
{{< page-nav prev="/influxdb/v2/get-started/process/" >}}
|
{{< page-nav prev="/influxdb/version/get-started/process/" >}}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Congratulations!
|
## Congratulations!
|
||||||
|
|
||||||
You have walked through the
|
You have walked through the
|
||||||
[basics of setting up, writing, querying, processing, and visualizing](/influxdb/v2/get-started/)
|
[basics of setting up, writing, querying, processing, and visualizing](/influxdb/version/get-started/)
|
||||||
data with InfluxDB {{< current-version >}}.
|
data with InfluxDB {{< current-version >}}.
|
||||||
Feel free to dive in deeper to each of these topics:
|
Feel free to dive in deeper to each of these topics:
|
||||||
|
|
||||||
- [Write data to InfluxDB](/influxdb/v2/write-data/)
|
- [Write data to InfluxDB](/influxdb/version/write-data/)
|
||||||
- [Query data in InfluxDB](/influxdb/v2/query-data/)
|
- [Query data in InfluxDB](/influxdb/version/query-data/)
|
||||||
- [Process data with InfluxDB](/influxdb/v2/process-data/)
|
- [Process data with InfluxDB](/influxdb/version/process-data/)
|
||||||
- [Visualize data with the InfluxDB UI](/influxdb/v2/visualize-data/)
|
- [Visualize data with the InfluxDB UI](/influxdb/version/visualize-data/)
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ InfluxDB provides many different options for ingesting or writing data, includin
|
||||||
the following:
|
the following:
|
||||||
|
|
||||||
- Influx user interface (UI)
|
- Influx user interface (UI)
|
||||||
- [InfluxDB HTTP API](/influxdb/v2/reference/api/)
|
- [InfluxDB HTTP API](/influxdb/version/reference/api/)
|
||||||
- [`influx` CLI](/influxdb/v2/tools/influx-cli/)
|
- [`influx` CLI](/influxdb/version/tools/influx-cli/)
|
||||||
- [Telegraf](/telegraf/v1/)
|
- [Telegraf](/telegraf/v1/)
|
||||||
- [InfluxDB client libraries](/influxdb/v2/api-guide/client-libraries/)
|
- [InfluxDB client libraries](/influxdb/version/api-guide/client-libraries/)
|
||||||
|
|
||||||
This tutorial walks you through the fundamental of using **line protocol** to write
|
This tutorial walks you through the fundamental of using **line protocol** to write
|
||||||
data to InfluxDB. If using tools like Telegraf or InfluxDB client libraries, they will
|
data to InfluxDB. If using tools like Telegraf or InfluxDB client libraries, they will
|
||||||
|
@ -17,7 +17,7 @@ build the line protocol for you, but it's good to understand how line protocol w
|
||||||
All data written to InfluxDB is written using **line protocol**, a text-based
|
All data written to InfluxDB is written using **line protocol**, a text-based
|
||||||
format that lets you provide the necessary information to write a data point to InfluxDB.
|
format that lets you provide the necessary information to write a data point to InfluxDB.
|
||||||
_This tutorial covers the basics of line protocol, but for detailed information,
|
_This tutorial covers the basics of line protocol, but for detailed information,
|
||||||
see the [Line protocol reference](/influxdb/v2/reference/syntax/line-protocol/)._
|
see the [Line protocol reference](/influxdb/version/reference/syntax/line-protocol/)._
|
||||||
|
|
||||||
### Line protocol elements
|
### Line protocol elements
|
||||||
|
|
||||||
|
@ -30,12 +30,12 @@ Each line of line protocol contains the following elements:
|
||||||
Tag keys and values are unquoted strings. _Spaces, commas, and equal characters must be escaped._
|
Tag keys and values are unquoted strings. _Spaces, commas, and equal characters must be escaped._
|
||||||
- {{< req "\*" >}} **field set**: Comma-delimited list key value pairs, each representing a field.
|
- {{< req "\*" >}} **field set**: Comma-delimited list key value pairs, each representing a field.
|
||||||
Field keys are unquoted strings. _Spaces and commas must be escaped._
|
Field keys are unquoted strings. _Spaces and commas must be escaped._
|
||||||
Field values can be [strings](/influxdb/v2/reference/syntax/line-protocol/#string) (quoted),
|
Field values can be [strings](/influxdb/version/reference/syntax/line-protocol/#string) (quoted),
|
||||||
[floats](/influxdb/v2/reference/syntax/line-protocol/#float),
|
[floats](/influxdb/version/reference/syntax/line-protocol/#float),
|
||||||
[integers](/influxdb/v2/reference/syntax/line-protocol/#integer),
|
[integers](/influxdb/version/reference/syntax/line-protocol/#integer),
|
||||||
[unsigned integers](/influxdb/v2/reference/syntax/line-protocol/#uinteger),
|
[unsigned integers](/influxdb/version/reference/syntax/line-protocol/#uinteger),
|
||||||
or [booleans](/influxdb/v2/reference/syntax/line-protocol/#boolean).
|
or [booleans](/influxdb/version/reference/syntax/line-protocol/#boolean).
|
||||||
- **timestamp**: [Unix timestamp](/influxdb/v2/reference/syntax/line-protocol/#unix-timestamp)
|
- **timestamp**: [Unix timestamp](/influxdb/version/reference/syntax/line-protocol/#unix-timestamp)
|
||||||
associated with the data. InfluxDB supports up to nanosecond precision.
|
associated with the data. InfluxDB supports up to nanosecond precision.
|
||||||
_If the precision of the timestamp is not in nanoseconds, you must specify the
|
_If the precision of the timestamp is not in nanoseconds, you must specify the
|
||||||
precision when writing the data to InfluxDB._
|
precision when writing the data to InfluxDB._
|
||||||
|
@ -55,7 +55,7 @@ Each line of line protocol contains the following elements:
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
_For schema design recommendations, see [InfluxDB schema design](/influxdb/v2/write-data/best-practices/schema-design/)._
|
_For schema design recommendations, see [InfluxDB schema design](/influxdb/version/write-data/best-practices/schema-design/)._
|
||||||
|
|
||||||
## Construct line protocol
|
## Construct line protocol
|
||||||
|
|
||||||
|
@ -148,8 +148,8 @@ The UI will confirm that the data has been written successfully.
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
<!---------------------------- BEGIN CLI CONTENT ----------------------------->
|
<!---------------------------- BEGIN CLI CONTENT ----------------------------->
|
||||||
|
|
||||||
1. If you haven't already, [download, install, and configure the `influx` CLI](/influxdb/v2/tools/influx-cli/).
|
1. If you haven't already, [download, install, and configure the `influx` CLI](/influxdb/version/tools/influx-cli/).
|
||||||
2. Use the [`influx write` command](/influxdb/v2/reference/cli/influx/write/)
|
2. Use the [`influx write` command](/influxdb/version/reference/cli/influx/write/)
|
||||||
to write the [line protocol above](#home-sensor-data-line-protocol) to InfluxDB.
|
to write the [line protocol above](#home-sensor-data-line-protocol) to InfluxDB.
|
||||||
|
|
||||||
**Provide the following**:
|
**Provide the following**:
|
||||||
|
@ -157,7 +157,7 @@ The UI will confirm that the data has been written successfully.
|
||||||
- `-b, --bucket` or `--bucket-id` flag with the bucket name or ID to write do.
|
- `-b, --bucket` or `--bucket-id` flag with the bucket name or ID to write do.
|
||||||
- `-p, --precision` flag with the timestamp precision (`s`).
|
- `-p, --precision` flag with the timestamp precision (`s`).
|
||||||
- String-encoded line protocol.
|
- String-encoded line protocol.
|
||||||
- [Connection and authentication credentials](/influxdb/v2/get-started/setup/?t=influx+CLI#configure-authentication-credentials)
|
- [Connection and authentication credentials](/influxdb/version/get-started/setup/?t=influx+CLI#configure-authentication-credentials)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influx write \
|
influx write \
|
||||||
|
@ -200,7 +200,7 @@ The UI will confirm that the data has been written successfully.
|
||||||
To write data to InfluxDB using the InfluxDB HTTP API, send a request to
|
To write data to InfluxDB using the InfluxDB HTTP API, send a request to
|
||||||
the InfluxDB API `/api/v2/write` endpoint using the `POST` request method.
|
the InfluxDB API `/api/v2/write` endpoint using the `POST` request method.
|
||||||
|
|
||||||
{{< api-endpoint endpoint="http://localhost:8086/api/v2/write" method="post" api-ref="/influxdb/v2/api/#operation/PostWrite" >}}
|
{{< api-endpoint endpoint="http://localhost:8086/api/v2/write" method="post" api-ref="/influxdb/version/api/#operation/PostWrite" >}}
|
||||||
|
|
||||||
Include the following with your request:
|
Include the following with your request:
|
||||||
|
|
||||||
|
@ -365,9 +365,9 @@ home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200
|
||||||
**Congratulations!** You have written data to InfluxDB. The method described
|
**Congratulations!** You have written data to InfluxDB. The method described
|
||||||
above is the manual way of writing data, but there are other options available:
|
above is the manual way of writing data, but there are other options available:
|
||||||
|
|
||||||
- [Write data to InfluxDB using no-code solutions](/influxdb/v2/write-data/no-code/)
|
- [Write data to InfluxDB using no-code solutions](/influxdb/version/write-data/no-code/)
|
||||||
- [Write data to InfluxDB using developer tools](/influxdb/v2/write-data/developer-tools/)
|
- [Write data to InfluxDB using developer tools](/influxdb/version/write-data/developer-tools/)
|
||||||
|
|
||||||
With data now stored in InfluxDB, let's query it.
|
With data now stored in InfluxDB, let's query it.
|
||||||
|
|
||||||
{{< page-nav prev="/influxdb/v2/get-started/setup/" next="/influxdb/v2/get-started/query/" keepTab=true >}}
|
{{< page-nav prev="/influxdb/version/get-started/setup/" next="/influxdb/version/get-started/query/" keepTab=true >}}
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
|
|
||||||
Monitor your time series data and send alerts by creating checks, notification
|
Monitor your time series data and send alerts by creating checks, notification
|
||||||
rules, and notification endpoints. Or use [community templates to monitor](/influxdb/v2/monitor-alert/templates/) supported environments.
|
rules, and notification endpoints. Or use [community templates to monitor](/influxdb/version/monitor-alert/templates/) supported environments.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
1. A [check](/influxdb/v2/reference/glossary/#check) in InfluxDB queries data and assigns a status with a `_level` based on specific conditions.
|
1. A [check](/influxdb/version/reference/glossary/#check) in InfluxDB queries data and assigns a status with a `_level` based on specific conditions.
|
||||||
2. InfluxDB stores the output of a check in the `statuses` measurement in the `_monitoring` system bucket.
|
2. InfluxDB stores the output of a check in the `statuses` measurement in the `_monitoring` system bucket.
|
||||||
3. [Notification rules](/influxdb/v2/reference/glossary/#notification-rule) check data in the `statuses`
|
3. [Notification rules](/influxdb/version/reference/glossary/#notification-rule) check data in the `statuses`
|
||||||
measurement and, based on conditions set in the notification rule, send a message
|
measurement and, based on conditions set in the notification rule, send a message
|
||||||
to a [notification endpoint](/influxdb/v2/reference/glossary/#notification-endpoint).
|
to a [notification endpoint](/influxdb/version/reference/glossary/#notification-endpoint).
|
||||||
4. InfluxDB stores notifications in the `notifications` measurement in the `_monitoring` system bucket.
|
4. InfluxDB stores notifications in the `notifications` measurement in the `_monitoring` system bucket.
|
||||||
|
|
||||||
## Create an alert
|
## Create an alert
|
||||||
|
|
||||||
To get started, do the following:
|
To get started, do the following:
|
||||||
|
|
||||||
1. [Create checks](/influxdb/v2/monitor-alert/checks/create/) to monitor data and assign a status.
|
1. [Create checks](/influxdb/version/monitor-alert/checks/create/) to monitor data and assign a status.
|
||||||
2. [Add notification endpoints](/influxdb/v2/monitor-alert/notification-endpoints/create/)
|
2. [Add notification endpoints](/influxdb/version/monitor-alert/notification-endpoints/create/)
|
||||||
to send notifications to third parties.
|
to send notifications to third parties.
|
||||||
3. [Create notification rules](/influxdb/v2/monitor-alert/notification-rules/create) to check
|
3. [Create notification rules](/influxdb/version/monitor-alert/notification-rules/create) to check
|
||||||
statuses and send notifications to your notifications endpoints.
|
statuses and send notifications to your notifications endpoints.
|
||||||
|
|
||||||
## Manage your monitoring and alerting pipeline
|
## Manage your monitoring and alerting pipeline
|
||||||
|
|
|
@ -77,7 +77,7 @@ in a specified amount of time.
|
||||||
|
|
||||||
Use custom tags to associate additional metadata with the check.
|
Use custom tags to associate additional metadata with the check.
|
||||||
Common metadata tags across different checks lets you easily group and organize checks.
|
Common metadata tags across different checks lets you easily group and organize checks.
|
||||||
You can also use custom tags in [notification rules](/influxdb/v2/monitor-alert/notification-rules/create/).
|
You can also use custom tags in [notification rules](/influxdb/version/monitor-alert/notification-rules/create/).
|
||||||
|
|
||||||
3. In the **{{< caps >}}Status Message Template{{< /caps >}}** column, enter
|
3. In the **{{< caps >}}Status Message Template{{< /caps >}}** column, enter
|
||||||
the status message template for the check.
|
the status message template for the check.
|
||||||
|
|
|
@ -15,6 +15,6 @@ After a check is deleted, all statuses generated by the check remain in the `_mo
|
||||||
bucket until the retention period for the bucket expires.
|
bucket until the retention period for the bucket expires.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
You can also [disable a check](/influxdb/v2/monitor-alert/checks/update/#enable-or-disable-a-check)
|
You can also [disable a check](/influxdb/version/monitor-alert/checks/update/#enable-or-disable-a-check)
|
||||||
without having to delete it.
|
without having to delete it.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
|
@ -18,7 +18,7 @@ To update checks, select **Alerts > Alerts** in the navigation menu on the left.
|
||||||
2. To edit the check query, click **{{< caps >}}1. Define Query{{< /caps >}}** at the top of the check builder window.
|
2. To edit the check query, click **{{< caps >}}1. Define Query{{< /caps >}}** at the top of the check builder window.
|
||||||
3. To edit the check logic, click **{{< caps >}}2. Configure Check{{< /caps >}}** at the top of the check builder window.
|
3. To edit the check logic, click **{{< caps >}}2. Configure Check{{< /caps >}}** at the top of the check builder window.
|
||||||
|
|
||||||
_For details about using the check builder, see [Create checks](/influxdb/v2/monitor-alert/checks/create/)._
|
_For details about using the check builder, see [Create checks](/influxdb/version/monitor-alert/checks/create/)._
|
||||||
|
|
||||||
## Enable or disable a check
|
## Enable or disable a check
|
||||||
Click the {{< icon "toggle" >}} toggle next to a check to enable or disable it.
|
Click the {{< icon "toggle" >}} toggle next to a check to enable or disable it.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
In the UI, you can create two kinds of [checks](/influxdb/v2/reference/glossary/#check):
|
In the UI, you can create two kinds of [checks](/influxdb/version/reference/glossary/#check):
|
||||||
[`threshold`](/influxdb/v2/monitor-alert/checks/create/#threshold-check) and
|
[`threshold`](/influxdb/version/monitor-alert/checks/create/#threshold-check) and
|
||||||
[`deadman`](/influxdb/v2/monitor-alert/checks/create/#deadman-check).
|
[`deadman`](/influxdb/version/monitor-alert/checks/create/#deadman-check).
|
||||||
|
|
||||||
Using a Flux task, you can create a custom check that provides a couple advantages:
|
Using a Flux task, you can create a custom check that provides a couple advantages:
|
||||||
|
|
||||||
|
@ -17,11 +17,11 @@ Using a Flux task, you can create a custom check that provides a couple advantag
|
||||||
2. Click **{{< caps >}}{{< icon "plus" >}} Create Task{{< /caps >}}**.
|
2. Click **{{< caps >}}{{< icon "plus" >}} Create Task{{< /caps >}}**.
|
||||||
3. In the **Name** field, enter a descriptive name,
|
3. In the **Name** field, enter a descriptive name,
|
||||||
and then enter how often to run the task in the **Every** field (for example, `10m`).
|
and then enter how often to run the task in the **Every** field (for example, `10m`).
|
||||||
For more detail, such as using cron syntax or including an offset, see [Task configuration options](/influxdb/v2/process-data/task-options/).
|
For more detail, such as using cron syntax or including an offset, see [Task configuration options](/influxdb/version/process-data/task-options/).
|
||||||
4. Enter the Flux script for your custom check, including the [`monitor.check`](/flux/v0/stdlib/influxdata/influxdb/monitor/check/) function.
|
4. Enter the Flux script for your custom check, including the [`monitor.check`](/flux/v0/stdlib/influxdata/influxdb/monitor/check/) function.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
Use the [`/api/v2/checks/{checkID}/query` API endpoint](/influxdb/v2/api/#operation/DeleteDashboardsIDOwnersID)
|
Use the [`/api/v2/checks/{checkID}/query` API endpoint](/influxdb/version/api/#operation/DeleteDashboardsIDOwnersID)
|
||||||
to see the Flux code for a check built in the UI.
|
to see the Flux code for a check built in the UI.
|
||||||
This can be useful for constructing custom checks.
|
This can be useful for constructing custom checks.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
@ -79,7 +79,7 @@ task_data
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
Creating a custom check does not send a notification email.
|
Creating a custom check does not send a notification email.
|
||||||
For information on how to create notification emails, see
|
For information on how to create notification emails, see
|
||||||
[Create notification endpoints](/influxdb/v2/monitor-alert/notification-endpoints/create),
|
[Create notification endpoints](/influxdb/version/monitor-alert/notification-endpoints/create),
|
||||||
[Create notification rules](/influxdb/v2/monitor-alert/notification-rules/create),
|
[Create notification rules](/influxdb/version/monitor-alert/notification-rules/create),
|
||||||
and [Send alert email](/influxdb/v2/monitor-alert/send-email/)
|
and [Send alert email](/influxdb/version/monitor-alert/send-email/)
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
To send notifications about changes in your data, start by creating a notification endpoint to a third-party service. After creating notification endpoints, [create notification rules](/influxdb/v2/monitor-alert/notification-rules/create) to send alerts to third-party services on [check statuses](/influxdb/v2/monitor-alert/checks/create).
|
To send notifications about changes in your data, start by creating a notification endpoint to a third-party service. After creating notification endpoints, [create notification rules](/influxdb/version/monitor-alert/notification-rules/create) to send alerts to third-party services on [check statuses](/influxdb/version/monitor-alert/checks/create).
|
||||||
|
|
||||||
{{% show-in "cloud,cloud-serverless" %}}
|
{{% show-in "cloud,cloud-serverless" %}}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
If notifications are no longer sent to an endpoint, complete the steps below to
|
If notifications are no longer sent to an endpoint, complete the steps below to
|
||||||
delete the endpoint, and then [update notification rules](/influxdb/v2/monitor-alert/notification-rules/update)
|
delete the endpoint, and then [update notification rules](/influxdb/version/monitor-alert/notification-rules/update)
|
||||||
with a new notification endpoint as needed.
|
with a new notification endpoint as needed.
|
||||||
|
|
||||||
## Delete a notification endpoint
|
## Delete a notification endpoint
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
Complete the following steps to update notification endpoint details.
|
Complete the following steps to update notification endpoint details.
|
||||||
To update the notification endpoint selected for a notification rule, see [update notification rules](/influxdb/v2/monitor-alert/notification-rules/update/).
|
To update the notification endpoint selected for a notification rule, see [update notification rules](/influxdb/version/monitor-alert/notification-rules/update/).
|
||||||
|
|
||||||
**To update a notification endpoint**
|
**To update a notification endpoint**
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ To update the notification endpoint selected for a notification rule, see [updat
|
||||||
## Change endpoint details
|
## Change endpoint details
|
||||||
1. Click the name of the endpoint to update.
|
1. Click the name of the endpoint to update.
|
||||||
2. Update details as needed, and then click **Edit Notification Endpoint**.
|
2. Update details as needed, and then click **Edit Notification Endpoint**.
|
||||||
For details about each field, see [Create notification endpoints](/influxdb/v2/monitor-alert/notification-endpoints/create/).
|
For details about each field, see [Create notification endpoints](/influxdb/version/monitor-alert/notification-endpoints/create/).
|
||||||
|
|
||||||
## Disable notification endpoint
|
## Disable notification endpoint
|
||||||
Click the {{< icon "toggle" >}} toggle to disable the notification endpoint.
|
Click the {{< icon "toggle" >}} toggle to disable the notification endpoint.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Once you've set up checks and notification endpoints, create notification rules to alert you.
|
Once you've set up checks and notification endpoints, create notification rules to alert you.
|
||||||
_For details, see [Manage checks](/influxdb/v2/monitor-alert/checks/) and
|
_For details, see [Manage checks](/influxdb/version/monitor-alert/checks/) and
|
||||||
[Manage notification endpoints](/influxdb/v2/monitor-alert/notification-endpoints/)._
|
[Manage notification endpoints](/influxdb/version/monitor-alert/notification-endpoints/)._
|
||||||
|
|
||||||
|
|
||||||
1. In the navigation menu on the left, select **Alerts > Alerts**.
|
1. In the navigation menu on the left, select **Alerts > Alerts**.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Send an alert email using a third-party service, such as [SendGrid](https://sendgrid.com/), [Amazon Simple Email Service (SES)](https://aws.amazon.com/ses/), [Mailjet](https://www.mailjet.com/), or [Mailgun](https://www.mailgun.com/). To send an alert email, complete the following steps:
|
Send an alert email using a third-party service, such as [SendGrid](https://sendgrid.com/), [Amazon Simple Email Service (SES)](https://aws.amazon.com/ses/), [Mailjet](https://www.mailjet.com/), or [Mailgun](https://www.mailgun.com/). To send an alert email, complete the following steps:
|
||||||
|
|
||||||
1. [Create a check](/influxdb/v2/monitor-alert/checks/create/#create-a-check-in-the-influxdb-ui) to identify the data to monitor and the status to alert on.
|
1. [Create a check](/influxdb/version/monitor-alert/checks/create/#create-a-check-in-the-influxdb-ui) to identify the data to monitor and the status to alert on.
|
||||||
2. Set up your preferred email service (sign up, retrieve API credentials, and send test email):
|
2. Set up your preferred email service (sign up, retrieve API credentials, and send test email):
|
||||||
- **SendGrid**: See [Getting Started With the SendGrid API](https://sendgrid.com/docs/API_Reference/api_getting_started.html)
|
- **SendGrid**: See [Getting Started With the SendGrid API](https://sendgrid.com/docs/API_Reference/api_getting_started.html)
|
||||||
- **AWS Simple Email Service (SES)**: See [Using the Amazon SES API](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email.html). Your AWS SES request, including the `url` (endpoint), authentication, and the structure of the request may vary. For more information, see [Amazon SES API requests](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/using-ses-api-requests.html) and [Authenticating requests to the Amazon SES API](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/using-ses-api-authentication.html).
|
- **AWS Simple Email Service (SES)**: See [Using the Amazon SES API](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email.html). Your AWS SES request, including the `url` (endpoint), authentication, and the structure of the request may vary. For more information, see [Amazon SES API requests](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/using-ses-api-requests.html) and [Authenticating requests to the Amazon SES API](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/using-ses-api-authentication.html).
|
||||||
|
@ -10,7 +10,7 @@ Send an alert email using a third-party service, such as [SendGrid](https://send
|
||||||
3. [Create an alert email task](#create-an-alert-email-task) to call your email service and send an alert email.
|
3. [Create an alert email task](#create-an-alert-email-task) to call your email service and send an alert email.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
In the procedure below, we use the **Task** page in the InfluxDB UI (user interface) to create a task. Explore other ways to [create a task](/influxdb/v2/process-data/manage-tasks/create-task/).
|
In the procedure below, we use the **Task** page in the InfluxDB UI (user interface) to create a task. Explore other ways to [create a task](/influxdb/version/process-data/manage-tasks/create-task/).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
### Create an alert email task
|
### Create an alert email task
|
||||||
|
@ -22,12 +22,12 @@ Send an alert email using a third-party service, such as [SendGrid](https://send
|
||||||
2. Click **{{< caps >}}{{< icon "plus" >}} Create Task{{< /caps >}}**.
|
2. Click **{{< caps >}}{{< icon "plus" >}} Create Task{{< /caps >}}**.
|
||||||
3. In the **Name** field, enter a descriptive name, for example, **Send alert email**,
|
3. In the **Name** field, enter a descriptive name, for example, **Send alert email**,
|
||||||
and then enter how often to run the task in the **Every** field, for example, `10m`.
|
and then enter how often to run the task in the **Every** field, for example, `10m`.
|
||||||
For more detail, such as using cron syntax or including an offset, see [Task configuration options](/influxdb/v2/process-data/task-options/).
|
For more detail, such as using cron syntax or including an offset, see [Task configuration options](/influxdb/version/process-data/task-options/).
|
||||||
|
|
||||||
4. In the right panel, enter the following detail in your **task script** (see [examples below](#examples)):
|
4. In the right panel, enter the following detail in your **task script** (see [examples below](#examples)):
|
||||||
- Import the [Flux HTTP package](/flux/v0/stdlib/http/).
|
- Import the [Flux HTTP package](/flux/v0/stdlib/http/).
|
||||||
- (Optional) Store your API key as a secret for reuse.
|
- (Optional) Store your API key as a secret for reuse.
|
||||||
First, [add your API key as a secret](/influxdb/v2/admin/secrets/add/),
|
First, [add your API key as a secret](/influxdb/version/admin/secrets/add/),
|
||||||
and then import the [Flux InfluxDB Secrets package](/flux/v0/stdlib/influxdata/influxdb/secrets/).
|
and then import the [Flux InfluxDB Secrets package](/flux/v0/stdlib/influxdata/influxdb/secrets/).
|
||||||
- Query the `statuses` measurement in the `_monitoring` bucket to retrieve all statuses generated by your check.
|
- Query the `statuses` measurement in the `_monitoring` bucket to retrieve all statuses generated by your check.
|
||||||
- Set the time range to monitor; use the same interval that the task is scheduled to run. For example, `range (start: -task.every)`.
|
- Set the time range to monitor; use the same interval that the task is scheduled to run. For example, `range (start: -task.every)`.
|
||||||
|
|
|
@ -3,23 +3,23 @@ Use the [AWS CloudWatch Monitoring template](https://github.com/influxdata/commu
|
||||||
|
|
||||||
The AWS CloudWatch Monitoring template includes the following:
|
The AWS CloudWatch Monitoring template includes the following:
|
||||||
|
|
||||||
- two [dashboards](/influxdb/v2/reference/glossary/#dashboard):
|
- two [dashboards](/influxdb/version/reference/glossary/#dashboard):
|
||||||
- **AWS CloudWatch NLB (Network Load Balancers) Monitoring**: Displays data from the `cloudwatch_aws_network_elb measurement`
|
- **AWS CloudWatch NLB (Network Load Balancers) Monitoring**: Displays data from the `cloudwatch_aws_network_elb measurement`
|
||||||
- **AWS CloudWatch Instance Monitoring**: Displays data from the `cloudwatch_aws_ec2` measurement
|
- **AWS CloudWatch Instance Monitoring**: Displays data from the `cloudwatch_aws_ec2` measurement
|
||||||
- two [buckets](/influxdb/v2/reference/glossary/#bucket): `kubernetes` and `cloudwatch`
|
- two [buckets](/influxdb/version/reference/glossary/#bucket): `kubernetes` and `cloudwatch`
|
||||||
- two labels: `inputs.cloudwatch`, `AWS`
|
- two labels: `inputs.cloudwatch`, `AWS`
|
||||||
- one variable: `v.bucket`
|
- one variable: `v.bucket`
|
||||||
- one [Telegraf configuration](/influxdb/v2/tools/telegraf-configs/): [AWS CloudWatch input plugin](/telegraf/v1/plugins//#cloudwatch)
|
- one [Telegraf configuration](/influxdb/version/tools/telegraf-configs/): [AWS CloudWatch input plugin](/telegraf/v1/plugins//#cloudwatch)
|
||||||
|
|
||||||
## Apply the template
|
## Apply the template
|
||||||
|
|
||||||
1. Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) to run the following command:
|
1. Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) to run the following command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/aws_cloudwatch/aws_cloudwatch.yml
|
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/aws_cloudwatch/aws_cloudwatch.yml
|
||||||
```
|
```
|
||||||
For more information, see [influx apply](/influxdb/v2/reference/cli/influx/apply/).
|
For more information, see [influx apply](/influxdb/version/reference/cli/influx/apply/).
|
||||||
2. [Install Telegraf](/telegraf/v1/introduction/installation/) on a server with network access to both the CloudWatch API and [InfluxDB v2 API](/influxdb/v2/reference/api/).
|
2. [Install Telegraf](/telegraf/v1/introduction/installation/) on a server with network access to both the CloudWatch API and [InfluxDB v2 API](/influxdb/version/reference/api/).
|
||||||
3. In your Telegraf configuration file (`telegraf.conf`), find the following example `influxdb_v2` output plugins, and then **replace** the `urls` to specify the servers to monitor:
|
3. In your Telegraf configuration file (`telegraf.conf`), find the following example `influxdb_v2` output plugins, and then **replace** the `urls` to specify the servers to monitor:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -37,7 +37,7 @@ The AWS CloudWatch Monitoring template includes the following:
|
||||||
organization = "$INFLUX_ORG"
|
organization = "$INFLUX_ORG"
|
||||||
bucket = “cloudwatch"
|
bucket = “cloudwatch"
|
||||||
```
|
```
|
||||||
4. [Start Telegraf](/influxdb/v2/write-data/no-code/use-telegraf/auto-config/#start-telegraf).
|
4. [Start Telegraf](/influxdb/version/write-data/no-code/use-telegraf/auto-config/#start-telegraf).
|
||||||
|
|
||||||
## View the incoming data
|
## View the incoming data
|
||||||
|
|
||||||
|
|
|
@ -4,39 +4,39 @@ This template uses the [Docker input plugin](/telegraf/v1/plugins//#docker) to c
|
||||||
|
|
||||||
The Docker Monitoring template includes the following:
|
The Docker Monitoring template includes the following:
|
||||||
|
|
||||||
- one [dashboard](/influxdb/v2/reference/glossary/#dashboard): **Docker**
|
- one [dashboard](/influxdb/version/reference/glossary/#dashboard): **Docker**
|
||||||
- one [bucket](/influxdb/v2/reference/glossary/#bucket): `docker, 7d retention`
|
- one [bucket](/influxdb/version/reference/glossary/#bucket): `docker, 7d retention`
|
||||||
- labels: Docker input plugin labels
|
- labels: Docker input plugin labels
|
||||||
- one [Telegraf configuration](/influxdb/v2/tools/telegraf-configs/): Docker input plugin
|
- one [Telegraf configuration](/influxdb/version/tools/telegraf-configs/): Docker input plugin
|
||||||
- one variable: `bucket`
|
- one variable: `bucket`
|
||||||
- four [checks](/influxdb/v2/reference/glossary/#check): `Container cpu`, `mem`, `disk`, `non-zero exit`
|
- four [checks](/influxdb/version/reference/glossary/#check): `Container cpu`, `mem`, `disk`, `non-zero exit`
|
||||||
- one [notification endpoint](/influxdb/v2/reference/glossary/#notification-endpoint): `Http Post`
|
- one [notification endpoint](/influxdb/version/reference/glossary/#notification-endpoint): `Http Post`
|
||||||
- one [notification rule](/influxdb/v2/reference/glossary/#notification-rule): `Crit Alert`
|
- one [notification rule](/influxdb/version/reference/glossary/#notification-rule): `Crit Alert`
|
||||||
|
|
||||||
For more information about how checks, notification endpoints, and notifications rules work together, see [monitor data and send alerts](/influxdb/v2/monitor-alert/).
|
For more information about how checks, notification endpoints, and notifications rules work together, see [monitor data and send alerts](/influxdb/version/monitor-alert/).
|
||||||
|
|
||||||
## Apply the template
|
## Apply the template
|
||||||
|
|
||||||
1. Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) to run the following command:
|
1. Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) to run the following command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml
|
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml
|
||||||
```
|
```
|
||||||
For more information, see [influx apply](/influxdb/v2/reference/cli/influx/apply/).
|
For more information, see [influx apply](/influxdb/version/reference/cli/influx/apply/).
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
Ensure your `influx` CLI is configured with your account credentials and that configuration is active. For more information, see [influx config](/influxdb/v2/reference/cli/influx/config/).
|
Ensure your `influx` CLI is configured with your account credentials and that configuration is active. For more information, see [influx config](/influxdb/version/reference/cli/influx/config/).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
2. [Install Telegraf](/telegraf/v1/introduction/installation/) on a server with network access to both the Docker containers and [InfluxDB v2 API](/influxdb/v2/reference/api/).
|
2. [Install Telegraf](/telegraf/v1/introduction/installation/) on a server with network access to both the Docker containers and [InfluxDB v2 API](/influxdb/version/reference/api/).
|
||||||
3. In your [Telegraf configuration file (`telegraf.conf`)](/influxdb/v2/tools/telegraf-configs/), do the following:
|
3. In your [Telegraf configuration file (`telegraf.conf`)](/influxdb/version/tools/telegraf-configs/), do the following:
|
||||||
- Depending on how you run Docker, you may need to customize the [Docker input plugin](/telegraf/v1/plugins//#docker) configuration, for example, you may need to specify the `endpoint` value.
|
- Depending on how you run Docker, you may need to customize the [Docker input plugin](/telegraf/v1/plugins//#docker) configuration, for example, you may need to specify the `endpoint` value.
|
||||||
- Set the following environment variables:
|
- Set the following environment variables:
|
||||||
- INFLUX_TOKEN: Token must have permissions to read Telegraf configurations and write data to the `telegraf` bucket. See how to [view tokens](/influxdb/v2/admin/tokens/view-tokens/).
|
- INFLUX_TOKEN: Token must have permissions to read Telegraf configurations and write data to the `telegraf` bucket. See how to [view tokens](/influxdb/version/admin/tokens/view-tokens/).
|
||||||
- INFLUX_ORG: Name of your organization. See how to [view your organization](/influxdb/v2/admin/organizations/view-orgs/).
|
- INFLUX_ORG: Name of your organization. See how to [view your organization](/influxdb/version/admin/organizations/view-orgs/).
|
||||||
- INFLUX_HOST: Your InfluxDB host URL, for example, localhost, a remote instance, or InfluxDB Cloud.
|
- INFLUX_HOST: Your InfluxDB host URL, for example, localhost, a remote instance, or InfluxDB Cloud.
|
||||||
|
|
||||||
4. [Start Telegraf](/influxdb/v2/write-data/no-code/use-telegraf/auto-config/#start-telegraf).
|
4. [Start Telegraf](/influxdb/version/write-data/no-code/use-telegraf/auto-config/#start-telegraf).
|
||||||
|
|
||||||
## View incoming data
|
## View incoming data
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ to monitor your Raspberry Pi 4 or 400 Linux system.
|
||||||
|
|
||||||
The Raspberry Pi template includes the following:
|
The Raspberry Pi template includes the following:
|
||||||
|
|
||||||
- one [bucket](/influxdb/v2/reference/glossary/#bucket): `rasp-pi` (7d retention)
|
- one [bucket](/influxdb/version/reference/glossary/#bucket): `rasp-pi` (7d retention)
|
||||||
- labels: `raspberry-pi` + Telegraf plugin labels
|
- labels: `raspberry-pi` + Telegraf plugin labels
|
||||||
- [Diskio input plugin](/telegraf/v1/plugins//#diskio)
|
- [Diskio input plugin](/telegraf/v1/plugins//#diskio)
|
||||||
- [Mem input plugin](/telegraf/v1/plugins//#mem)
|
- [Mem input plugin](/telegraf/v1/plugins//#mem)
|
||||||
|
@ -12,26 +12,26 @@ The Raspberry Pi template includes the following:
|
||||||
- [Processes input plugin](/telegraf/v1/plugins//#processes)
|
- [Processes input plugin](/telegraf/v1/plugins//#processes)
|
||||||
- [Swap input plugin](/telegraf/v1/plugins//#swap)
|
- [Swap input plugin](/telegraf/v1/plugins//#swap)
|
||||||
- [System input plugin](/telegraf/v1/plugins//#system)
|
- [System input plugin](/telegraf/v1/plugins//#system)
|
||||||
- one [Telegraf configuration](/influxdb/v2/tools/telegraf-configs/)
|
- one [Telegraf configuration](/influxdb/version/tools/telegraf-configs/)
|
||||||
- one [dashboard](/influxdb/v2/reference/glossary/#dashboard): Raspberry Pi System
|
- one [dashboard](/influxdb/version/reference/glossary/#dashboard): Raspberry Pi System
|
||||||
- two variables: `bucket` and `linux_host`
|
- two variables: `bucket` and `linux_host`
|
||||||
|
|
||||||
## Apply the template
|
## Apply the template
|
||||||
|
|
||||||
1. Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) to run the following command:
|
1. Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) to run the following command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/raspberry-pi/raspberry-pi-system.yml
|
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/raspberry-pi/raspberry-pi-system.yml
|
||||||
```
|
```
|
||||||
For more information, see [influx apply](/influxdb/v2/reference/cli/influx/apply/).
|
For more information, see [influx apply](/influxdb/version/reference/cli/influx/apply/).
|
||||||
2. [Install Telegraf](/telegraf/v1/introduction/installation/) on
|
2. [Install Telegraf](/telegraf/v1/introduction/installation/) on
|
||||||
your Raspberry Pi and ensure your Raspberry Pi has network access to the
|
your Raspberry Pi and ensure your Raspberry Pi has network access to the
|
||||||
[InfluxDB {{% show-in "cloud,cloud-serverless" %}}Cloud{{% /show-in %}} API](/influxdb/v2/reference/api/).
|
[InfluxDB {{% show-in "cloud,cloud-serverless" %}}Cloud{{% /show-in %}} API](/influxdb/version/reference/api/).
|
||||||
3. Add the following environment variables to your Telegraf environment:
|
3. Add the following environment variables to your Telegraf environment:
|
||||||
|
|
||||||
- `INFLUX_HOST`: {{% show-in "v2" %}}Your [InfluxDB URL](/influxdb/v2/reference/urls/){{% /show-in %}}
|
- `INFLUX_HOST`: {{% show-in "v2" %}}Your [InfluxDB URL](/influxdb/version/reference/urls/){{% /show-in %}}
|
||||||
{{% show-in "cloud,cloud-serverless" %}}Your [InfluxDB Cloud region URL](/influxdb/cloud/reference/regions/){{% /show-in %}}
|
{{% show-in "cloud,cloud-serverless" %}}Your [InfluxDB Cloud region URL](/influxdb/cloud/reference/regions/){{% /show-in %}}
|
||||||
- `INFLUX_TOKEN`: Your [InfluxDB {{% show-in "cloud,cloud-serverless" %}}Cloud{{% /show-in %}} API token](/influxdb/v2/admin/tokens/)
|
- `INFLUX_TOKEN`: Your [InfluxDB {{% show-in "cloud,cloud-serverless" %}}Cloud{{% /show-in %}} API token](/influxdb/version/admin/tokens/)
|
||||||
- `INFLUX_ORG`: Your InfluxDB {{% show-in "cloud,cloud-serverless" %}}Cloud{{% /show-in %}} organization name.
|
- `INFLUX_ORG`: Your InfluxDB {{% show-in "cloud,cloud-serverless" %}}Cloud{{% /show-in %}} organization name.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -40,7 +40,7 @@ The Raspberry Pi template includes the following:
|
||||||
export INFLUX_ORG=example-org
|
export INFLUX_ORG=example-org
|
||||||
```
|
```
|
||||||
|
|
||||||
4. [Start Telegraf](/influxdb/v2/write-data/no-code/use-telegraf/auto-config/#start-telegraf).
|
4. [Start Telegraf](/influxdb/version/write-data/no-code/use-telegraf/auto-config/#start-telegraf).
|
||||||
|
|
||||||
## View the incoming data
|
## View the incoming data
|
||||||
|
|
||||||
|
|
|
@ -4,30 +4,30 @@ This template uses the [Docker input plugin](/telegraf/v1/plugins//#docker) to c
|
||||||
|
|
||||||
The Docker Monitoring template includes the following:
|
The Docker Monitoring template includes the following:
|
||||||
|
|
||||||
- one [dashboard](/influxdb/v2/reference/glossary/#dashboard): **vsphere**
|
- one [dashboard](/influxdb/version/reference/glossary/#dashboard): **vsphere**
|
||||||
- one [bucket](/influxdb/v2/reference/glossary/#bucket): `vsphere`
|
- one [bucket](/influxdb/version/reference/glossary/#bucket): `vsphere`
|
||||||
- label: vsphere
|
- label: vsphere
|
||||||
- one [Telegraf configuration](/influxdb/v2/tools/telegraf-configs/): InfluxDB v2 output plugin, vSphere input plugin
|
- one [Telegraf configuration](/influxdb/version/tools/telegraf-configs/): InfluxDB v2 output plugin, vSphere input plugin
|
||||||
- one variable: `bucket`
|
- one variable: `bucket`
|
||||||
|
|
||||||
## Apply the template
|
## Apply the template
|
||||||
|
|
||||||
1. Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) to run the following command:
|
1. Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) to run the following command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/vsphere/vsphere.yml
|
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/vsphere/vsphere.yml
|
||||||
```
|
```
|
||||||
For more information, see [influx apply](/influxdb/v2/reference/cli/influx/apply/).
|
For more information, see [influx apply](/influxdb/version/reference/cli/influx/apply/).
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
Ensure your `influx` CLI is configured with your account credentials and that configuration is active. For more information, see [influx config](/influxdb/v2/reference/cli/influx/config/).
|
Ensure your `influx` CLI is configured with your account credentials and that configuration is active. For more information, see [influx config](/influxdb/version/reference/cli/influx/config/).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
2. [Install Telegraf](/telegraf/v1/introduction/installation/) on a server with network access to both the vSphere host and [InfluxDB v2 API](/influxdb/v2/reference/api/).
|
2. [Install Telegraf](/telegraf/v1/introduction/installation/) on a server with network access to both the vSphere host and [InfluxDB v2 API](/influxdb/version/reference/api/).
|
||||||
3. In your [Telegraf configuration file (`telegraf.conf`)](/influxdb/v2/tools/telegraf-configs/), do the following:
|
3. In your [Telegraf configuration file (`telegraf.conf`)](/influxdb/version/tools/telegraf-configs/), do the following:
|
||||||
- Set the following environment variables:
|
- Set the following environment variables:
|
||||||
- INFLUX_TOKEN: Token must have permissions to read Telegraf configurations and write data to the `telegraf` bucket. See how to [view tokens](/influxdb/v2/admin/tokens/view-tokens/).
|
- INFLUX_TOKEN: Token must have permissions to read Telegraf configurations and write data to the `telegraf` bucket. See how to [view tokens](/influxdb/version/admin/tokens/view-tokens/).
|
||||||
- INFLUX_ORG: Name of your organization. See how to [view your organization](/influxdb/v2/admin/organizations/view-orgs/).
|
- INFLUX_ORG: Name of your organization. See how to [view your organization](/influxdb/version/admin/organizations/view-orgs/).
|
||||||
- INFLUX_HOST: Your InfluxDB host URL, for example, localhost, a remote instance, or InfluxDB Cloud.
|
- INFLUX_HOST: Your InfluxDB host URL, for example, localhost, a remote instance, or InfluxDB Cloud.
|
||||||
- INFLUX_BUCKET: Bucket to store data in. To use the bucket included, you must export the variable: `export INFLUX_BUCKET=vsphere`
|
- INFLUX_BUCKET: Bucket to store data in. To use the bucket included, you must export the variable: `export INFLUX_BUCKET=vsphere`
|
||||||
4. - Set the host address to the vSphere and provide the `username` and `password` as variables:
|
4. - Set the host address to the vSphere and provide the `username` and `password` as variables:
|
||||||
|
@ -37,7 +37,7 @@ Ensure your `influx` CLI is configured with your account credentials and that co
|
||||||
password = "$vsphere-password"
|
password = "$vsphere-password"
|
||||||
```
|
```
|
||||||
|
|
||||||
4. [Start Telegraf](/influxdb/v2/write-data/no-code/use-telegraf/auto-config/#start-telegraf).
|
4. [Start Telegraf](/influxdb/version/write-data/no-code/use-telegraf/auto-config/#start-telegraf).
|
||||||
|
|
||||||
## View incoming data
|
## View incoming data
|
||||||
|
|
||||||
|
|
|
@ -3,33 +3,33 @@ Use the [Windows System Monitoring template](https://github.com/influxdata/commu
|
||||||
|
|
||||||
The Windows System Monitoring template includes the following:
|
The Windows System Monitoring template includes the following:
|
||||||
|
|
||||||
- one [dashboard](/influxdb/v2/reference/glossary/#dashboard): **Windows System**
|
- one [dashboard](/influxdb/version/reference/glossary/#dashboard): **Windows System**
|
||||||
- one [bucket](/influxdb/v2/reference/glossary/#bucket): `telegraf`, 7d retention
|
- one [bucket](/influxdb/version/reference/glossary/#bucket): `telegraf`, 7d retention
|
||||||
- label: `Windows System Template`, Telegraf plugin labels: `outputs.influxdb_v2`
|
- label: `Windows System Template`, Telegraf plugin labels: `outputs.influxdb_v2`
|
||||||
- one [Telegraf configuration](/influxdb/v2/tools/telegraf-configs/): InfluxDB v2 output plugin, Windows Performance Counters input plugin
|
- one [Telegraf configuration](/influxdb/version/tools/telegraf-configs/): InfluxDB v2 output plugin, Windows Performance Counters input plugin
|
||||||
- two variables: `bucket`, `windows_host`
|
- two variables: `bucket`, `windows_host`
|
||||||
|
|
||||||
## Apply the template
|
## Apply the template
|
||||||
|
|
||||||
1. Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) to run the following command:
|
1. Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) to run the following command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/windows_system/windows_system.yml
|
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/windows_system/windows_system.yml
|
||||||
```
|
```
|
||||||
For more information, see [influx apply](/influxdb/v2/reference/cli/influx/apply/).
|
For more information, see [influx apply](/influxdb/version/reference/cli/influx/apply/).
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
Ensure your `influx` CLI is configured with your account credentials and that configuration is active. For more information, see [influx config](/influxdb/v2/reference/cli/influx/config/).
|
Ensure your `influx` CLI is configured with your account credentials and that configuration is active. For more information, see [influx config](/influxdb/version/reference/cli/influx/config/).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
2. [Install Telegraf](/telegraf/v1/introduction/installation/) on a server with network access to both the Windows system and [InfluxDB v2 API](/influxdb/v2/reference/api/).
|
2. [Install Telegraf](/telegraf/v1/introduction/installation/) on a server with network access to both the Windows system and [InfluxDB v2 API](/influxdb/version/reference/api/).
|
||||||
3. In your [Telegraf configuration file (`telegraf.conf`)](/influxdb/v2/tools/telegraf-configs/), do the following:
|
3. In your [Telegraf configuration file (`telegraf.conf`)](/influxdb/version/tools/telegraf-configs/), do the following:
|
||||||
- Set the following environment variables:
|
- Set the following environment variables:
|
||||||
- INFLUX_TOKEN: Token must have permissions to read Telegraf configurations and write data to the `telegraf` bucket. See how to [view tokens](/influxdb/v2/admin/tokens/view-tokens/).
|
- INFLUX_TOKEN: Token must have permissions to read Telegraf configurations and write data to the `telegraf` bucket. See how to [view tokens](/influxdb/version/admin/tokens/view-tokens/).
|
||||||
- INFLUX_ORG: Name of your organization. See how to [view your organization](/influxdb/v2/admin/organizations/view-orgs/).
|
- INFLUX_ORG: Name of your organization. See how to [view your organization](/influxdb/version/admin/organizations/view-orgs/).
|
||||||
- INFLUX_URL: Your InfluxDB host URL, for example, localhost, a remote instance, or InfluxDB Cloud.
|
- INFLUX_URL: Your InfluxDB host URL, for example, localhost, a remote instance, or InfluxDB Cloud.
|
||||||
|
|
||||||
4. [Start Telegraf](/influxdb/v2/write-data/no-code/use-telegraf/auto-config/#start-telegraf).
|
4. [Start Telegraf](/influxdb/version/write-data/no-code/use-telegraf/auto-config/#start-telegraf).
|
||||||
5. To monitor multiple Windows systems, repeat steps 1-4 for each system.
|
5. To monitor multiple Windows systems, repeat steps 1-4 for each system.
|
||||||
|
|
||||||
## View incoming data
|
## View incoming data
|
||||||
|
|
|
@ -17,7 +17,7 @@ Do the following:
|
||||||
Before you begin, make sure you have access to the following:
|
Before you begin, make sure you have access to the following:
|
||||||
|
|
||||||
- InfluxDB Cloud account ([sign up for free here](https://cloud2.influxdata.com/signup))
|
- InfluxDB Cloud account ([sign up for free here](https://cloud2.influxdata.com/signup))
|
||||||
- Command line access to a machine [running InfluxDB OSS 2.x](/influxdb/v2/install/) and permissions to install Telegraf on this machine
|
- Command line access to a machine [running InfluxDB OSS 2.x](/influxdb/version/install/) and permissions to install Telegraf on this machine
|
||||||
- Internet connectivity from the machine running InfluxDB OSS 2.x and Telegraf to InfluxDB Cloud
|
- Internet connectivity from the machine running InfluxDB OSS 2.x and Telegraf to InfluxDB Cloud
|
||||||
- Sufficient resource availability to install the template (InfluxDB Cloud Free
|
- Sufficient resource availability to install the template (InfluxDB Cloud Free
|
||||||
Plan accounts include [resource limits](/influxdb/cloud/account-management/pricing-plans/#resource-limits/influxdb/cloud/account-management/pricing-plans/#resource-limits))
|
Plan accounts include [resource limits](/influxdb/cloud/account-management/pricing-plans/#resource-limits/influxdb/cloud/account-management/pricing-plans/#resource-limits))
|
||||||
|
@ -53,9 +53,9 @@ InfluxDB OSS metrics to an InfluxDB endpoint and a dashboard that visualizes the
|
||||||
By default, InfluxDB OSS 2.x has a `/metrics` endpoint available, which exports
|
By default, InfluxDB OSS 2.x has a `/metrics` endpoint available, which exports
|
||||||
internal InfluxDB metrics in [Prometheus format](https://prometheus.io/docs/concepts/data_model/).
|
internal InfluxDB metrics in [Prometheus format](https://prometheus.io/docs/concepts/data_model/).
|
||||||
|
|
||||||
1. Ensure the `/metrics` endpoint is [enabled](/influxdb/v2/reference/config-options/#metrics-disabled).
|
1. Ensure the `/metrics` endpoint is [enabled](/influxdb/version/reference/config-options/#metrics-disabled).
|
||||||
If you've changed the default settings to disable the `/metrics` endpoint,
|
If you've changed the default settings to disable the `/metrics` endpoint,
|
||||||
[re-enable these settings](/influxdb/v2/reference/config-options/#metrics-disabled).
|
[re-enable these settings](/influxdb/version/reference/config-options/#metrics-disabled).
|
||||||
2. Navigate to the `/metrics` endpoint of your InfluxDB OSS instance to view the InfluxDB OSS system metrics in your browser:
|
2. Navigate to the `/metrics` endpoint of your InfluxDB OSS instance to view the InfluxDB OSS system metrics in your browser:
|
||||||
|
|
||||||
## Set up Telegraf
|
## Set up Telegraf
|
||||||
|
|
|
@ -4,31 +4,31 @@ This template uses the [HAProxy input plugin](/telegraf/v1/plugins//#haproxy) to
|
||||||
|
|
||||||
The HAProxy for InfluxDB v2 template includes the following:
|
The HAProxy for InfluxDB v2 template includes the following:
|
||||||
|
|
||||||
- one [dashboard](/influxdb/v2/reference/glossary/#dashboard): **HAProxy**
|
- one [dashboard](/influxdb/version/reference/glossary/#dashboard): **HAProxy**
|
||||||
- one [bucket](/influxdb/v2/reference/glossary/#bucket): `haproxy`
|
- one [bucket](/influxdb/version/reference/glossary/#bucket): `haproxy`
|
||||||
- label: `haproxy`
|
- label: `haproxy`
|
||||||
- one [Telegraf configuration](/influxdb/v2/tools/telegraf-configs/): HAProxy input plugin, InfluxDB v2 output plugin
|
- one [Telegraf configuration](/influxdb/version/tools/telegraf-configs/): HAProxy input plugin, InfluxDB v2 output plugin
|
||||||
- one variable: `bucket`
|
- one variable: `bucket`
|
||||||
|
|
||||||
## Apply the template
|
## Apply the template
|
||||||
|
|
||||||
1. Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) to run the following command:
|
1. Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) to run the following command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/haproxy/haproxy.yml
|
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/haproxy/haproxy.yml
|
||||||
```
|
```
|
||||||
For more information, see [influx apply](/influxdb/v2/reference/cli/influx/apply/).
|
For more information, see [influx apply](/influxdb/version/reference/cli/influx/apply/).
|
||||||
|
|
||||||
> **Note:** Ensure your `influx` CLI is configured with your account credentials and that configuration is active. For more information, see [influx config](/influxdb/v2/reference/cli/influx/config/).
|
> **Note:** Ensure your `influx` CLI is configured with your account credentials and that configuration is active. For more information, see [influx config](/influxdb/version/reference/cli/influx/config/).
|
||||||
|
|
||||||
2. [Install Telegraf](/telegraf/v1/introduction/installation/) on a server with network access to both the HAProxy instances and [InfluxDB v2 API](/influxdb/v2/reference/api/).
|
2. [Install Telegraf](/telegraf/v1/introduction/installation/) on a server with network access to both the HAProxy instances and [InfluxDB v2 API](/influxdb/version/reference/api/).
|
||||||
3. In your [Telegraf configuration file (`telegraf.conf`)](/influxdb/v2/tools/telegraf-configs/), do the following:
|
3. In your [Telegraf configuration file (`telegraf.conf`)](/influxdb/version/tools/telegraf-configs/), do the following:
|
||||||
- Set the following environment variables:
|
- Set the following environment variables:
|
||||||
- INFLUX_TOKEN: Token must have permissions to read Telegraf configurations and write data to the `haproxy` bucket. See how to [view tokens](/influxdb/v2/admin/tokens/view-tokens/).
|
- INFLUX_TOKEN: Token must have permissions to read Telegraf configurations and write data to the `haproxy` bucket. See how to [view tokens](/influxdb/version/admin/tokens/view-tokens/).
|
||||||
- INFLUX_ORG: Name of your organization. See how to [view your organization](/influxdb/v2/admin/organizations/view-orgs/).
|
- INFLUX_ORG: Name of your organization. See how to [view your organization](/influxdb/version/admin/organizations/view-orgs/).
|
||||||
- INFLUX_HOST: Your InfluxDB host URL, for example, localhost, a remote instance, or InfluxDB Cloud.
|
- INFLUX_HOST: Your InfluxDB host URL, for example, localhost, a remote instance, or InfluxDB Cloud.
|
||||||
|
|
||||||
4. [Start Telegraf](/influxdb/v2/write-data/no-code/use-telegraf/auto-config/#start-telegraf).
|
4. [Start Telegraf](/influxdb/version/write-data/no-code/use-telegraf/auto-config/#start-telegraf).
|
||||||
|
|
||||||
## View incoming data
|
## View incoming data
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,11 @@ The following example shows how to set task options in a Flux script:
|
||||||
option task = {name: "downsample_5m_precision", every: 1h, offset: 0m}
|
option task = {name: "downsample_5m_precision", every: 1h, offset: 0m}
|
||||||
```
|
```
|
||||||
|
|
||||||
_See [Task configuration options](/influxdb/v2/process-data/task-options) for detailed information
|
_See [Task configuration options](/influxdb/version/process-data/task-options) for detailed information
|
||||||
about each option._
|
about each option._
|
||||||
|
|
||||||
_Note that InfluxDB doesn't guarantee that a task will run at the scheduled time.
|
_Note that InfluxDB doesn't guarantee that a task will run at the scheduled time.
|
||||||
See [View task run logs for a task](/influxdb/v2/process-data/manage-tasks/task-run-history)
|
See [View task run logs for a task](/influxdb/version/process-data/manage-tasks/task-run-history)
|
||||||
for detailed information on task service-level agreements (SLAs)._
|
for detailed information on task service-level agreements (SLAs)._
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
|
@ -133,7 +133,7 @@ A task that runs at one hour intervals (`every: 1h`) with an offset of five minu
|
||||||
executes 5 minutes after the hour, but queries data from the original one-hour interval.
|
executes 5 minutes after the hour, but queries data from the original one-hour interval.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
_See [Common tasks](/influxdb/v2/process-data/common-tasks) for examples of tasks commonly used with InfluxDB._
|
_See [Common tasks](/influxdb/version/process-data/common-tasks) for examples of tasks commonly used with InfluxDB._
|
||||||
|
|
||||||
{{% show-in "cloud,cloud-serverless" %}}
|
{{% show-in "cloud,cloud-serverless" %}}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Create tasks with the InfluxDB user interface (UI), `influx` command line interface (CLI), or `/api/v2` API.
|
Create tasks with the InfluxDB user interface (UI), `influx` command line interface (CLI), or `/api/v2` API.
|
||||||
|
|
||||||
_Before creating a task, review the [basics for writing a task](/influxdb/v2/process-data/get-started)._
|
_Before creating a task, review the [basics for writing a task](/influxdb/version/process-data/get-started)._
|
||||||
|
|
||||||
- [InfluxDB UI](#create-a-task-in-the-influxdb-ui)
|
- [InfluxDB UI](#create-a-task-in-the-influxdb-ui)
|
||||||
- [`influx` CLI](#create-a-task-using-the-influx-cli)
|
- [`influx` CLI](#create-a-task-using-the-influx-cli)
|
||||||
|
@ -25,7 +25,7 @@ The InfluxDB UI provides multiple ways to create a task:
|
||||||
|
|
||||||
2. Build a query and click **Save As** in the upper right.
|
2. Build a query and click **Save As** in the upper right.
|
||||||
3. Select the **{{< caps >}}Task{{< /caps >}}** heading.
|
3. Select the **{{< caps >}}Task{{< /caps >}}** heading.
|
||||||
4. Specify the task options. See [Task options](/influxdb/v2/process-data/task-options)
|
4. Specify the task options. See [Task options](/influxdb/version/process-data/task-options)
|
||||||
for detailed information about each option.
|
for detailed information about each option.
|
||||||
5. Click **{{< caps >}}Save as Task{{< /caps >}}**.
|
5. Click **{{< caps >}}Save as Task{{< /caps >}}**.
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ The InfluxDB UI provides multiple ways to create a task:
|
||||||
|
|
||||||
2. Click **{{< caps >}}{{< icon "plus" >}} Create Task{{< /caps >}}** in the upper right.
|
2. Click **{{< caps >}}{{< icon "plus" >}} Create Task{{< /caps >}}** in the upper right.
|
||||||
3. In the left panel, specify the task options.
|
3. In the left panel, specify the task options.
|
||||||
See [Task options](/influxdb/v2/process-data/task-options) for detailed information about each option.
|
See [Task options](/influxdb/version/process-data/task-options) for detailed information about each option.
|
||||||
4. In the right panel, enter your task script.
|
4. In the right panel, enter your task script.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
|
@ -45,7 +45,7 @@ The InfluxDB UI provides multiple ways to create a task:
|
||||||
##### Leave out the option tasks assignment
|
##### Leave out the option tasks assignment
|
||||||
|
|
||||||
When creating a _new_ task in the InfluxDB Task UI, leave the code editor empty.
|
When creating a _new_ task in the InfluxDB Task UI, leave the code editor empty.
|
||||||
When you save the task, the Task UI uses the [task options](/influxdb/v2/process-data/task-options/) you specify in the **Task options** form to populate `option task = {task_options}` for you.
|
When you save the task, the Task UI uses the [task options](/influxdb/version/process-data/task-options/) you specify in the **Task options** form to populate `option task = {task_options}` for you.
|
||||||
|
|
||||||
When you edit the saved task, you'll see the injected `option task = {task_options}`.
|
When you edit the saved task, you'll see the injected `option task = {task_options}`.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
@ -60,7 +60,7 @@ When you edit the saved task, you'll see the injected `option task = {task_optio
|
||||||
|
|
||||||
2. Click **{{< caps >}}{{< icon "plus" >}} Create Task{{< /caps >}}** in the upper right.
|
2. Click **{{< caps >}}{{< icon "plus" >}} Create Task{{< /caps >}}** in the upper right.
|
||||||
3. In the left panel, specify the task options.
|
3. In the left panel, specify the task options.
|
||||||
See [Task options](/influxdb/v2/process-data/task-options) for detailed information about each option.
|
See [Task options](/influxdb/version/process-data/task-options) for detailed information about each option.
|
||||||
4. Paste a raw Flux task in the code editor to the right of the task options fields.
|
4. Paste a raw Flux task in the code editor to the right of the task options fields.
|
||||||
5. Click **{{< caps >}}Save{{< /caps >}}** in the upper right.
|
5. Click **{{< caps >}}Save{{< /caps >}}** in the upper right.
|
||||||
|
|
||||||
|
@ -117,9 +117,9 @@ option task = {
|
||||||
|
|
||||||
{{% show-in "v2" %}}
|
{{% show-in "v2" %}}
|
||||||
|
|
||||||
Use the [`/api/v2/tasks` InfluxDB API endpoint](/influxdb/v2/api/#operation/PostTasks) to create a task.
|
Use the [`/api/v2/tasks` InfluxDB API endpoint](/influxdb/version/api/#operation/PostTasks) to create a task.
|
||||||
|
|
||||||
{{< api-endpoint method="POST" endpoint="http://localhost:8086/api/v2/tasks/" api-ref="/influxdb/v2/api/#operation/PostTasks" >}}
|
{{< api-endpoint method="POST" endpoint="http://localhost:8086/api/v2/tasks/" api-ref="/influxdb/version/api/#operation/PostTasks" >}}
|
||||||
|
|
||||||
Provide the following in your API request:
|
Provide the following in your API request:
|
||||||
##### Request headers
|
##### Request headers
|
||||||
|
@ -132,7 +132,7 @@ Provide the following in your API request:
|
||||||
JSON object with the following fields:
|
JSON object with the following fields:
|
||||||
|
|
||||||
- **flux**: raw Flux task string that contains a [`task` option](/flux/v0/spec/options/) and a query.
|
- **flux**: raw Flux task string that contains a [`task` option](/flux/v0/spec/options/) and a query.
|
||||||
- **orgID**: your [InfluxDB organization ID](/influxdb/v2/admin/organizations/view-orgs/#view-your-organization-id)
|
- **orgID**: your [InfluxDB organization ID](/influxdb/version/admin/organizations/view-orgs/#view-your-organization-id)
|
||||||
- **status**: task status ("active" or "inactive")
|
- **status**: task status ("active" or "inactive")
|
||||||
- **description**: task description
|
- **description**: task description
|
||||||
|
|
||||||
|
|
|
@ -19,17 +19,17 @@ influx task delete -i <task-id>
|
||||||
influx task delete -i 0343698431c35000
|
influx task delete -i 0343698431c35000
|
||||||
```
|
```
|
||||||
|
|
||||||
_To find the task ID, see [how to view tasks](/influxdb/v2/process-data/manage-tasks/view-tasks/)_
|
_To find the task ID, see [how to view tasks](/influxdb/version/process-data/manage-tasks/view-tasks/)_
|
||||||
|
|
||||||
## Delete a task using the InfluxDB API
|
## Delete a task using the InfluxDB API
|
||||||
|
|
||||||
Use the [`/tasks/TASK_ID` InfluxDB API endpoint](/influxdb/v2/api/#operation/DeleteTasksID) to delete a task and all associated records (task runs, logs, and labels).
|
Use the [`/tasks/TASK_ID` InfluxDB API endpoint](/influxdb/version/api/#operation/DeleteTasksID) to delete a task and all associated records (task runs, logs, and labels).
|
||||||
|
|
||||||
{{< api-endpoint method="DELETE" endpoint="http://localhost:8086/api/v2/tasks/TASK_ID" api-ref="/influxdb/v2/api/#operation/DeleteTasksID" >}}
|
{{< api-endpoint method="DELETE" endpoint="http://localhost:8086/api/v2/tasks/TASK_ID" api-ref="/influxdb/version/api/#operation/DeleteTasksID" >}}
|
||||||
|
|
||||||
_To find the task ID, see [how to view tasks](/influxdb/v2/process-data/manage-tasks/view-tasks/)_
|
_To find the task ID, see [how to view tasks](/influxdb/version/process-data/manage-tasks/view-tasks/)_
|
||||||
|
|
||||||
Once the task is deleted, InfluxDB cancels all scheduled runs of the task.
|
Once the task is deleted, InfluxDB cancels all scheduled runs of the task.
|
||||||
|
|
||||||
If you want to disable a task instead of delete it, see how to
|
If you want to disable a task instead of delete it, see how to
|
||||||
[update the task status](/influxdb/v2/process-data/manage-tasks/update-task/) to `inactive`.
|
[update the task status](/influxdb/version/process-data/manage-tasks/update-task/) to `inactive`.
|
||||||
|
|
|
@ -33,7 +33,7 @@ influx task run retry --task-id=0000000000000000 --run-id=0000000000000000
|
||||||
```
|
```
|
||||||
|
|
||||||
### Retry failed task runs
|
### Retry failed task runs
|
||||||
Use the [`influx task retry-failed` command](/influxdb/v2/reference/cli/influx/task/retry-failed/)
|
Use the [`influx task retry-failed` command](/influxdb/version/reference/cli/influx/task/retry-failed/)
|
||||||
to retry failed task runs.
|
to retry failed task runs.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -52,13 +52,13 @@ influx task retry-failed \
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run a task with the InfluxDB API
|
## Run a task with the InfluxDB API
|
||||||
Use the [`/tasks/TASK_ID/runs` InfluxDB API endpoint](/influxdb/v2/api/#operation/PostTasksIDRuns)
|
Use the [`/tasks/TASK_ID/runs` InfluxDB API endpoint](/influxdb/version/api/#operation/PostTasksIDRuns)
|
||||||
to manually start a task run.
|
to manually start a task run.
|
||||||
|
|
||||||
{{< api-endpoint method="POST" endpoint="http://localhost:8086/api/v2/tasks/TASK_ID/runs" api-ref="/influxdb/v2/api/#operation/PostTasksIDRuns" >}}
|
{{< api-endpoint method="POST" endpoint="http://localhost:8086/api/v2/tasks/TASK_ID/runs" api-ref="/influxdb/version/api/#operation/PostTasksIDRuns" >}}
|
||||||
|
|
||||||
### Retry failed task runs
|
### Retry failed task runs
|
||||||
Use the [`/tasks/TASK_ID/runs/RUN_ID/retry` InfluxDB API endpoint](/influxdb/v2/api/#operation/PostTasksIDRunsIDRetry)
|
Use the [`/tasks/TASK_ID/runs/RUN_ID/retry` InfluxDB API endpoint](/influxdb/version/api/#operation/PostTasksIDRunsIDRetry)
|
||||||
to retry a task run.
|
to retry a task run.
|
||||||
|
|
||||||
{{< api-endpoint method="POST" endpoint="http://localhost:8086/api/v2/tasks/TASK_ID/runs/RUN_ID/retry" api-ref="/influxdb/v2/api/#operation/PostTasksIDRunsIDRetry" >}}
|
{{< api-endpoint method="POST" endpoint="http://localhost:8086/api/v2/tasks/TASK_ID/runs/RUN_ID/retry" api-ref="/influxdb/version/api/#operation/PostTasksIDRunsIDRetry" >}}
|
||||||
|
|
|
@ -45,27 +45,27 @@ influx task run list --task-id=0000000000000000
|
||||||
Detailed run logs are not currently available in the `influx` CLI.
|
Detailed run logs are not currently available in the `influx` CLI.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
To retry failed task runs, see how to [run tasks](/influxdb/v2/process-data/manage-tasks/run-task/).
|
To retry failed task runs, see how to [run tasks](/influxdb/version/process-data/manage-tasks/run-task/).
|
||||||
|
|
||||||
## View logs for a task with the InfluxDB API
|
## View logs for a task with the InfluxDB API
|
||||||
|
|
||||||
Use the [`/api/v2/tasks/TASK_ID/logs` InfluxDB API endpoint](/influxdb/v2/api/#operation/GetTasksIDLogs)
|
Use the [`/api/v2/tasks/TASK_ID/logs` InfluxDB API endpoint](/influxdb/version/api/#operation/GetTasksIDLogs)
|
||||||
to view the log events for a task and exclude additional task metadata.
|
to view the log events for a task and exclude additional task metadata.
|
||||||
|
|
||||||
{{< api-endpoint method="GET" endpoint="http://localhost:8086/api/v2/tasks/TASK_ID/logs" api-ref="/influxdb/v2/api/#operation/GetTasksIDLogs" >}}
|
{{< api-endpoint method="GET" endpoint="http://localhost:8086/api/v2/tasks/TASK_ID/logs" api-ref="/influxdb/version/api/#operation/GetTasksIDLogs" >}}
|
||||||
|
|
||||||
## View a task's run history with the InfluxDB API
|
## View a task's run history with the InfluxDB API
|
||||||
|
|
||||||
Use the [`/tasks/TASK_ID/runs` InfluxDB API endpoint](/influxdb/v2/api/#operation/GetTasksIDRuns)
|
Use the [`/tasks/TASK_ID/runs` InfluxDB API endpoint](/influxdb/version/api/#operation/GetTasksIDRuns)
|
||||||
to view a task's run history.
|
to view a task's run history.
|
||||||
|
|
||||||
{{< api-endpoint method="GET" endpoint="http://localhost:8086/api/v2/tasks/{taskID}/runs" api-ref="/influxdb/v2/api/#operation/GetTasksIDRuns" >}}
|
{{< api-endpoint method="GET" endpoint="http://localhost:8086/api/v2/tasks/{taskID}/runs" api-ref="/influxdb/version/api/#operation/GetTasksIDRuns" >}}
|
||||||
|
|
||||||
### View task run logs with the InfluxDB API
|
### View task run logs with the InfluxDB API
|
||||||
|
|
||||||
To view logs associated with a run, use the
|
To view logs associated with a run, use the
|
||||||
[`/api/v2/tasks/TASK_ID/runs/RUN_ID/logs` InfluxDB API endpoint](/influxdb/v2/api/#operation/GetTasksIDRunsIDLogs).
|
[`/api/v2/tasks/TASK_ID/runs/RUN_ID/logs` InfluxDB API endpoint](/influxdb/version/api/#operation/GetTasksIDRunsIDLogs).
|
||||||
|
|
||||||
{{< api-endpoint method="GET" endpoint="http://localhost:8086/api/v2/tasks/TASK_ID/runs/RUN_ID/logs" api-ref="/influxdb/v2/api/#operation/GetTasksIDRunsIDLogs" >}}
|
{{< api-endpoint method="GET" endpoint="http://localhost:8086/api/v2/tasks/TASK_ID/runs/RUN_ID/logs" api-ref="/influxdb/version/api/#operation/GetTasksIDRunsIDLogs" >}}
|
||||||
|
|
||||||
To retry failed task runs, see how to [run tasks](/influxdb/v2/process-data/manage-tasks/run-task/).
|
To retry failed task runs, see how to [run tasks](/influxdb/version/process-data/manage-tasks/run-task/).
|
||||||
|
|
|
@ -31,7 +31,7 @@ _This command requires a task ID, which is available in the output of `influx ta
|
||||||
#### Update a task Flux script
|
#### Update a task Flux script
|
||||||
Pass the file path of your updated Flux script to the `influx task update` command
|
Pass the file path of your updated Flux script to the `influx task update` command
|
||||||
with the ID of the task you want to update.
|
with the ID of the task you want to update.
|
||||||
Modified [task options](/influxdb/v2/process-data/task-options) defined in the Flux
|
Modified [task options](/influxdb/version/process-data/task-options) defined in the Flux
|
||||||
script are also updated.
|
script are also updated.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -61,13 +61,13 @@ influx task update -i 0343698431c35000 --status inactive
|
||||||
```
|
```
|
||||||
|
|
||||||
## Update a task with the InfluxDB API
|
## Update a task with the InfluxDB API
|
||||||
Use the [`/tasks/TASK_ID` InfluxDB API endpoint](/influxdb/v2/api/#operation/PatchTasksID) to update properties of a task.
|
Use the [`/tasks/TASK_ID` InfluxDB API endpoint](/influxdb/version/api/#operation/PatchTasksID) to update properties of a task.
|
||||||
|
|
||||||
{{< api-endpoint method="PATCH" endpoint="http://localhost:8086/api/v2/tasks/TASK_ID" api-ref="/influxdb/v2/api/#operation/PatchTasksID" >}}
|
{{< api-endpoint method="PATCH" endpoint="http://localhost:8086/api/v2/tasks/TASK_ID" api-ref="/influxdb/version/api/#operation/PatchTasksID" >}}
|
||||||
|
|
||||||
In your request, pass the task ID and an object that contains the updated key-value pairs.
|
In your request, pass the task ID and an object that contains the updated key-value pairs.
|
||||||
To activate or inactivate a task, set the `status` property.
|
To activate or inactivate a task, set the `status` property.
|
||||||
`"status": "inactive"` cancels scheduled runs and prevents manual runs of the task.
|
`"status": "inactive"` cancels scheduled runs and prevents manual runs of the task.
|
||||||
_To find the task ID, see [how to view tasks](/influxdb/v2/process-data/manage-tasks/view-tasks/)._
|
_To find the task ID, see [how to view tasks](/influxdb/version/process-data/manage-tasks/view-tasks/)._
|
||||||
|
|
||||||
Once InfluxDB applies the update, it cancels all previously scheduled runs of the task.
|
Once InfluxDB applies the update, it cancels all previously scheduled runs of the task.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
The following articles walk through common queries using the
|
The following articles walk through common queries using the
|
||||||
[NOAA water database data](/influxdb/v2/reference/sample-data/#noaa-water-sample-data).
|
[NOAA water database data](/influxdb/version/reference/sample-data/#noaa-water-sample-data).
|
||||||
|
|
||||||
{{< children >}}
|
{{< children >}}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<!-- Shortcode -->
|
<!-- Shortcode -->
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
This example uses [NOAA water sample data](/influxdb/v2/reference/sample-data/#noaa-water-sample-data).
|
This example uses [NOAA water sample data](/influxdb/version/reference/sample-data/#noaa-water-sample-data).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
This example compares the value from the latest point to an average value stored in another bucket. This is useful when using the average value to calculate a [threshold check](/influxdb/v2/monitor-alert/checks/create/#threshold-check).
|
This example compares the value from the latest point to an average value stored in another bucket. This is useful when using the average value to calculate a [threshold check](/influxdb/version/monitor-alert/checks/create/#threshold-check).
|
||||||
|
|
||||||
The following query:
|
The following query:
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ The result shows that 88.66% of time production is in the `OK` state, and that 1
|
||||||
|
|
||||||
#### Mosaic visualization
|
#### Mosaic visualization
|
||||||
|
|
||||||
The [mosaic visualization](/influxdb/v2/visualize-data/visualization-types/mosaic/) displays state changes over time. In this example, the mosaic visualization displays different colored tiles based on the `state` field.
|
The [mosaic visualization](/influxdb/version/visualize-data/visualization-types/mosaic/) displays state changes over time. In this example, the mosaic visualization displays different colored tiles based on the `state` field.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
from(bucket: "machine")
|
from(bucket: "machine")
|
||||||
|
|
|
@ -47,7 +47,7 @@ to align multiple fields by time.
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
To correctly pivot on `_time`, points for each field must have identical timestamps.
|
To correctly pivot on `_time`, points for each field must have identical timestamps.
|
||||||
If timestamps are irregular or do not align perfectly, see
|
If timestamps are irregular or do not align perfectly, see
|
||||||
[Normalize irregular timestamps](/influxdb/v2/query-data/flux/manipulate-timestamps/#normalize-irregular-timestamps).
|
[Normalize irregular timestamps](/influxdb/version/query-data/flux/manipulate-timestamps/#normalize-irregular-timestamps).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
|
@ -6,7 +6,7 @@ Use the following common queries to operate on columns:
|
||||||
- [Calculate a new column](#calculate-a-new-column)
|
- [Calculate a new column](#calculate-a-new-column)
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
These examples use [NOAA water sample data](/influxdb/v2/reference/sample-data/#noaa-water-sample-data).
|
These examples use [NOAA water sample data](/influxdb/version/reference/sample-data/#noaa-water-sample-data).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
## Find and count unique values in a column
|
## Find and count unique values in a column
|
||||||
|
|
|
@ -4,13 +4,13 @@ Build, execute, and visualize your queries in InfluxDB UI's **Data Explorer**.
|
||||||

|

|
||||||
|
|
||||||
Move seamlessly between using the Flux builder or templates and manually editing the query.
|
Move seamlessly between using the Flux builder or templates and manually editing the query.
|
||||||
Choose between [visualization types](/influxdb/v2/visualize-data/visualization-types/) for your query.
|
Choose between [visualization types](/influxdb/version/visualize-data/visualization-types/) for your query.
|
||||||
|
|
||||||
## Query data with Flux and the Data Explorer
|
## Query data with Flux and the Data Explorer
|
||||||
|
|
||||||
Flux is a functional data scripting language designed for querying,
|
Flux is a functional data scripting language designed for querying,
|
||||||
analyzing, and acting on time series data.
|
analyzing, and acting on time series data.
|
||||||
See [Get started with Flux](/influxdb/v2/query-data/get-started) to learn more about Flux.
|
See [Get started with Flux](/influxdb/version/query-data/get-started) to learn more about Flux.
|
||||||
|
|
||||||
1. In the navigation menu on the left, click **Data Explorer**.
|
1. In the navigation menu on the left, click **Data Explorer**.
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ See [Get started with Flux](/influxdb/v2/query-data/get-started) to learn more a
|
||||||
- Select a bucket to define your data source or select `+ Create Bucket` to add a new bucket.
|
- Select a bucket to define your data source or select `+ Create Bucket` to add a new bucket.
|
||||||
- Edit your time range with the [time range option](#select-time-range) in the dropdown menu.
|
- Edit your time range with the [time range option](#select-time-range) in the dropdown menu.
|
||||||
- Add filters to narrow your data by selecting attributes or columns in the dropdown menu.
|
- Add filters to narrow your data by selecting attributes or columns in the dropdown menu.
|
||||||
- Select **Group** from the **Filter** dropdown menu to group data into tables. For more about how grouping data in Flux works, see [Group data](/influxdb/v2/query-data/flux/group-data/).
|
- Select **Group** from the **Filter** dropdown menu to group data into tables. For more about how grouping data in Flux works, see [Group data](/influxdb/version/query-data/flux/group-data/).
|
||||||
3. Alternatively, click **Script Editor** to manually edit the query.
|
3. Alternatively, click **Script Editor** to manually edit the query.
|
||||||
To switch back to the query builder, click **Query Builder**. Note that your updates from the Script Editor will not be saved.
|
To switch back to the query builder, click **Query Builder**. Note that your updates from the Script Editor will not be saved.
|
||||||
4. Use the **Functions** list to review the available Flux functions.
|
4. Use the **Functions** list to review the available Flux functions.
|
||||||
|
@ -33,7 +33,7 @@ See [Get started with Flux](/influxdb/v2/query-data/get-started) to learn more a
|
||||||
|
|
||||||
## Visualize your query
|
## Visualize your query
|
||||||
|
|
||||||
- Select an available [visualization types](/influxdb/v2/visualize-data/visualization-types/) from the dropdown menu in the upper-left:
|
- Select an available [visualization types](/influxdb/version/visualize-data/visualization-types/) from the dropdown menu in the upper-left:
|
||||||
|
|
||||||
{{< img-hd src="/img/influxdb/2-0-visualizations-dropdown.png" title="Visualization dropdown" />}}
|
{{< img-hd src="/img/influxdb/2-0-visualizations-dropdown.png" title="Visualization dropdown" />}}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
The [Flux REPL](/influxdb/v2/tools/flux-repl/) starts an interactive
|
The [Flux REPL](/influxdb/version/tools/flux-repl/) starts an interactive
|
||||||
Read-Eval-Print Loop (REPL) where you can write and execute Flux queries.
|
Read-Eval-Print Loop (REPL) where you can write and execute Flux queries.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./flux repl
|
./flux repl
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information, see [Use the Flux REPL](/influxdb/v2/tools/flux-repl/).
|
For more information, see [Use the Flux REPL](/influxdb/version/tools/flux-repl/).
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
The [InfluxDB v2 API](/influxdb/v2/reference/api) provides a programmatic interface for all interactions with InfluxDB.
|
The [InfluxDB v2 API](/influxdb/version/reference/api) provides a programmatic interface for all interactions with InfluxDB.
|
||||||
To query InfluxDB {{< current-version >}}, do one of the following:
|
To query InfluxDB {{< current-version >}}, do one of the following:
|
||||||
|
|
||||||
- Send a Flux query request to the [`/api/v2/query`](/influxdb/v2/api/#operation/PostQueryAnalyze) endpoint.
|
- Send a Flux query request to the [`/api/v2/query`](/influxdb/version/api/#operation/PostQueryAnalyze) endpoint.
|
||||||
- Send an InfluxQL query request to the [/query 1.x compatibility API](/influxdb/v2/reference/api/influxdb-1x/query/).
|
- Send an InfluxQL query request to the [/query 1.x compatibility API](/influxdb/version/reference/api/influxdb-1x/query/).
|
||||||
|
|
||||||
In your request, set the following:
|
In your request, set the following:
|
||||||
|
|
||||||
|
@ -98,4 +98,4 @@ curl --request -G http://localhost:8086/query?orgID=INFLUX_ORG_ID&database=MyDB&
|
||||||
{{% /code-tab-content %}}
|
{{% /code-tab-content %}}
|
||||||
{{< /code-tabs-wrapper >}}
|
{{< /code-tabs-wrapper >}}
|
||||||
|
|
||||||
InfluxDB returns the query results in [annotated CSV](/influxdb/v2/reference/syntax/annotated-csv/).
|
InfluxDB returns the query results in [annotated CSV](/influxdb/version/reference/syntax/annotated-csv/).
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
Use the [`influx query` command](/influxdb/v2/reference/cli/influx/query) to query data in InfluxDB using Flux.
|
Use the [`influx query` command](/influxdb/version/reference/cli/influx/query) to query data in InfluxDB using Flux.
|
||||||
Pass Flux queries to the command as either a file or via stdin.
|
Pass Flux queries to the command as either a file or via stdin.
|
||||||
|
|
||||||
###### Run a query from a file
|
###### Run a query from a file
|
||||||
|
|
|
@ -8,7 +8,7 @@ Use `map()` to re-map values in the row and calculate a percentage.
|
||||||
1. Use [`from()`](/flux/v0/stdlib/influxdata/influxdb/from/),
|
1. Use [`from()`](/flux/v0/stdlib/influxdata/influxdb/from/),
|
||||||
[`range()`](/flux/v0/stdlib/universe/range/) and
|
[`range()`](/flux/v0/stdlib/universe/range/) and
|
||||||
[`filter()`](/flux/v0/stdlib/universe/filter/) to query operands.
|
[`filter()`](/flux/v0/stdlib/universe/filter/) to query operands.
|
||||||
2. Use [`pivot()` or `join()`](/influxdb/v2/query-data/flux/mathematic-operations/#pivot-vs-join)
|
2. Use [`pivot()` or `join()`](/influxdb/version/query-data/flux/mathematic-operations/#pivot-vs-join)
|
||||||
to align operand values into rows.
|
to align operand values into rows.
|
||||||
3. Use [`map()`](/flux/v0/stdlib/universe/map/)
|
3. Use [`map()`](/flux/v0/stdlib/universe/map/)
|
||||||
to divide the numerator operand value by the denominator operand value and multiply by 100.
|
to divide the numerator operand value by the denominator operand value and multiply by 100.
|
||||||
|
@ -16,7 +16,7 @@ Use `map()` to re-map values in the row and calculate a percentage.
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
The following examples use `pivot()` to align operands into rows because
|
The following examples use `pivot()` to align operands into rows because
|
||||||
`pivot()` works in most cases and is more performant than `join()`.
|
`pivot()` works in most cases and is more performant than `join()`.
|
||||||
_See [Pivot vs join](/influxdb/v2/query-data/flux/mathematic-operations/#pivot-vs-join)._
|
_See [Pivot vs join](/influxdb/version/query-data/flux/mathematic-operations/#pivot-vs-join)._
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -151,7 +151,7 @@ from(bucket: "example-bucket")
|
||||||
|
|
||||||
#### Calculate percentages using multiple measurements
|
#### Calculate percentages using multiple measurements
|
||||||
|
|
||||||
1. Ensure measurements are in the same [bucket](/influxdb/v2/reference/glossary/#bucket).
|
1. Ensure measurements are in the same [bucket](/influxdb/version/reference/glossary/#bucket).
|
||||||
2. Use `filter()` to include data from both measurements.
|
2. Use `filter()` to include data from both measurements.
|
||||||
3. Use `group()` to ungroup data and return a single table.
|
3. Use `group()` to ungroup data and return a single table.
|
||||||
4. Use `pivot()` to pivot fields into columns.
|
4. Use `pivot()` to pivot fields into columns.
|
||||||
|
|
|
@ -4,7 +4,7 @@ Flux provides `if`, `then`, and `else` conditional expressions that allow for po
|
||||||
If you're just getting started with Flux queries, check out the following:
|
If you're just getting started with Flux queries, check out the following:
|
||||||
|
|
||||||
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
||||||
- [Execute queries](/influxdb/v2/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
- [Execute queries](/influxdb/version/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
||||||
|
|
||||||
##### Conditional expression syntax
|
##### Conditional expression syntax
|
||||||
```js
|
```js
|
||||||
|
@ -59,7 +59,7 @@ overdue = if dueDate < now() then true else false
|
||||||
```
|
```
|
||||||
|
|
||||||
### Create conditional filters
|
### Create conditional filters
|
||||||
The following example uses an example `metric` [dashboard variable](/influxdb/v2/visualize-data/variables/)
|
The following example uses an example `metric` [dashboard variable](/influxdb/version/visualize-data/variables/)
|
||||||
to change how the query filters data.
|
to change how the query filters data.
|
||||||
`metric` has three possible values:
|
`metric` has three possible values:
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ to calculate a running total of values.
|
||||||
{{< /flex >}}
|
{{< /flex >}}
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
The examples below use the [example data variable](/influxdb/v2/query-data/flux/#example-data-variable).
|
The examples below use the [example data variable](/influxdb/version/query-data/flux/#example-data-variable).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
##### Calculate the running total of values
|
##### Calculate the running total of values
|
||||||
|
@ -40,7 +40,7 @@ data
|
||||||
[`aggregateWindow()`](/flux/v0/stdlib/universe/aggregatewindow/)
|
[`aggregateWindow()`](/flux/v0/stdlib/universe/aggregatewindow/)
|
||||||
segments data into windows of time, aggregates data in each window into a single
|
segments data into windows of time, aggregates data in each window into a single
|
||||||
point, then removes the time-based segmentation.
|
point, then removes the time-based segmentation.
|
||||||
It is primarily used to [downsample data](/influxdb/v2/process-data/common-tasks/downsample-data/).
|
It is primarily used to [downsample data](/influxdb/version/process-data/common-tasks/downsample-data/).
|
||||||
|
|
||||||
`aggregateWindow()` expects an aggregate function that returns a single row for each time window.
|
`aggregateWindow()` expects an aggregate function that returns a single row for each time window.
|
||||||
To use `cumulativeSum()` with `aggregateWindow`, use `sum` in `aggregateWindow()`,
|
To use `cumulativeSum()` with `aggregateWindow`, use `sum` in `aggregateWindow()`,
|
||||||
|
|
|
@ -122,7 +122,7 @@ from(bucket: "example-bucket")
|
||||||
|
|
||||||
## Define functions with scoped variables
|
## Define functions with scoped variables
|
||||||
To create custom functions with variables scoped to the function, place your
|
To create custom functions with variables scoped to the function, place your
|
||||||
function operations and variables inside of a [block (`{}`)](/influxdb/v2/reference/flux/language/blocks/)
|
function operations and variables inside of a [block (`{}`)](/influxdb/version/reference/flux/language/blocks/)
|
||||||
and use a `return` statement to return a specific variable.
|
and use a `return` statement to return a specific variable.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
|
@ -128,7 +128,7 @@ it isn't included in the output table.
|
||||||
|
|
||||||
## Custom aggregate function examples
|
## Custom aggregate function examples
|
||||||
To create custom aggregate functions, use principles outlined in
|
To create custom aggregate functions, use principles outlined in
|
||||||
[Creating custom functions](/influxdb/v2/query-data/flux/custom-functions)
|
[Creating custom functions](/influxdb/version/query-data/flux/custom-functions)
|
||||||
and the `reduce()` function to aggregate rows in each input table.
|
and the `reduce()` function to aggregate rows in each input table.
|
||||||
|
|
||||||
### Create a custom average function
|
### Create a custom average function
|
||||||
|
|
|
@ -9,7 +9,7 @@ column's value is _null_.
|
||||||
If you're just getting started with Flux queries, check out the following:
|
If you're just getting started with Flux queries, check out the following:
|
||||||
|
|
||||||
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
||||||
- [Execute queries](/influxdb/v2/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
- [Execute queries](/influxdb/version/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
||||||
|
|
||||||
Use `exists` with row functions (
|
Use `exists` with row functions (
|
||||||
[`filter()`](/flux/v0/stdlib/universe/filter/),
|
[`filter()`](/flux/v0/stdlib/universe/filter/),
|
||||||
|
|
|
@ -9,7 +9,7 @@ data stored in InfluxDB.
|
||||||
- [List tag values](#list-tag-values)
|
- [List tag values](#list-tag-values)
|
||||||
|
|
||||||
{{% warn %}}
|
{{% warn %}}
|
||||||
Functions in the `schema` package are not supported in the [Flux REPL](/influxdb/v2/tools/repl/).
|
Functions in the `schema` package are not supported in the [Flux REPL](/influxdb/version/tools/repl/).
|
||||||
{{% /warn %}}
|
{{% /warn %}}
|
||||||
|
|
||||||
## List buckets
|
## List buckets
|
||||||
|
|
|
@ -42,8 +42,8 @@ To return the version of Flux installed with InfluxDB using the InfluxDB UI:
|
||||||
3. Enable the **View Raw Data {{< icon "toggle" >}}** toggle or select one of the
|
3. Enable the **View Raw Data {{< icon "toggle" >}}** toggle or select one of the
|
||||||
following visualization types:
|
following visualization types:
|
||||||
|
|
||||||
- [Single Stat](/influxdb/v2/visualize-data/visualization-types/single-stat/)
|
- [Single Stat](/influxdb/version/visualize-data/visualization-types/single-stat/)
|
||||||
- [Table](/influxdb/v2/visualize-data/visualization-types/table/)
|
- [Table](/influxdb/version/visualize-data/visualization-types/table/)
|
||||||
|
|
||||||
4. Enter and run the following query:
|
4. Enter and run the following query:
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ use the `influx query` command. Provide the following:
|
||||||
|
|
||||||
- InfluxDB **host**, **organization**, and **API token**
|
- InfluxDB **host**, **organization**, and **API token**
|
||||||
_(the example below assumes that a
|
_(the example below assumes that a
|
||||||
[CLI configuration](/influxdb/v2/reference/cli/influx/#provide-required-authentication-credentials)
|
[CLI configuration](/influxdb/version/reference/cli/influx/#provide-required-authentication-credentials)
|
||||||
is set up and active)_
|
is set up and active)_
|
||||||
- Query to execute
|
- Query to execute
|
||||||
|
|
||||||
|
@ -85,9 +85,9 @@ Table: keys: []
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
|
|
||||||
To return the version of Flux installed with InfluxDB using the InfluxDB API,
|
To return the version of Flux installed with InfluxDB using the InfluxDB API,
|
||||||
use the [`/api/v2/query` endpoint](/influxdb/v2/api/#tag/Query).
|
use the [`/api/v2/query` endpoint](/influxdb/version/api/#tag/Query).
|
||||||
|
|
||||||
{{< api-endpoint method="POST" endpoint="http://localhost:8086/api/v2/query" api-ref="/influxdb/v2/api/#operation/PostQuery" >}}
|
{{< api-endpoint method="POST" endpoint="http://localhost:8086/api/v2/query" api-ref="/influxdb/version/api/#operation/PostQuery" >}}
|
||||||
Provide the following:
|
Provide the following:
|
||||||
|
|
||||||
- InfluxDB {{% show-in "cloud,cloud-serverless" %}}Cloud{{% /show-in %}} host
|
- InfluxDB {{% show-in "cloud,cloud-serverless" %}}Cloud{{% /show-in %}} host
|
||||||
|
@ -118,7 +118,7 @@ curl --request POST \
|
||||||
|
|
||||||
{{% warn %}}
|
{{% warn %}}
|
||||||
#### Flux version in the Flux REPL
|
#### Flux version in the Flux REPL
|
||||||
When you run `runtime.version()` in the [Flux REPL](/influxdb/v2/tools/flux-repl/),
|
When you run `runtime.version()` in the [Flux REPL](/influxdb/version/tools/flux-repl/),
|
||||||
the function returns the version of Flux the REPL was built with, not the version
|
the function returns the version of Flux the REPL was built with, not the version
|
||||||
of Flux installed in the instance of InfluxDB you're querying.
|
of Flux installed in the instance of InfluxDB you're querying.
|
||||||
{{% /warn %}}
|
{{% /warn %}}
|
|
@ -29,7 +29,7 @@ By using it, you agree to the [risks of experimental functions](/flux/v0/stdlib/
|
||||||
## Sample data
|
## Sample data
|
||||||
Many of the examples in this section use a `sampleGeoData` variable that represents
|
Many of the examples in this section use a `sampleGeoData` variable that represents
|
||||||
a sample set of geo-temporal data.
|
a sample set of geo-temporal data.
|
||||||
The [Bird Migration Sample Data](/influxdb/v2/reference/sample-data/#bird-migration-sample-data)
|
The [Bird Migration Sample Data](/influxdb/version/reference/sample-data/#bird-migration-sample-data)
|
||||||
provides sample geo-temporal data that meets the
|
provides sample geo-temporal data that meets the
|
||||||
[requirements of the Flux Geo package](/flux/v0/stdlib/experimental/geo/#geo-schema-requirements).
|
[requirements of the Flux Geo package](/flux/v0/stdlib/experimental/geo/#geo-schema-requirements).
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ to filter geo-temporal data by geographic region:
|
||||||
1. [Define a geographic region](#define-a-geographic-region)
|
1. [Define a geographic region](#define-a-geographic-region)
|
||||||
2. [Use strict or non-strict filtering](#strict-and-non-strict-filtering)
|
2. [Use strict or non-strict filtering](#strict-and-non-strict-filtering)
|
||||||
|
|
||||||
The following example uses the [sample bird migration data](/influxdb/v2/query-data/flux/geo/#sample-data)
|
The following example uses the [sample bird migration data](/influxdb/version/query-data/flux/geo/#sample-data)
|
||||||
and queries data points **within 200km of Cairo, Egypt**:
|
and queries data points **within 200km of Cairo, Egypt**:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
|
@ -6,7 +6,7 @@ to group data into tracks or routes.
|
||||||
- [Group data into tracks or routes](#group-data-by-track-or-route)
|
- [Group data into tracks or routes](#group-data-by-track-or-route)
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
For example results, use the [bird migration sample data](/influxdb/v2/reference/sample-data/#bird-migration-sample-data)
|
For example results, use the [bird migration sample data](/influxdb/version/reference/sample-data/#bird-migration-sample-data)
|
||||||
to populate the `sampleGeoData` variable in the queries below.
|
to populate the `sampleGeoData` variable in the queries below.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ Areas are determined by [S2 grid cells](https://s2geometry.io/devguide/s2cell_hi
|
||||||
- Specify the [S2 cell level](https://s2geometry.io/resources/s2cell_statistics)
|
- Specify the [S2 cell level](https://s2geometry.io/resources/s2cell_statistics)
|
||||||
to use when calculating geographic areas with the `level` parameter.
|
to use when calculating geographic areas with the `level` parameter.
|
||||||
|
|
||||||
The following example uses the [sample bird migration data](/influxdb/v2/query-data/flux/geo/#sample-data)
|
The following example uses the [sample bird migration data](/influxdb/version/query-data/flux/geo/#sample-data)
|
||||||
to query data points within 200km of Cairo, Egypt and group them by geographic area:
|
to query data points within 200km of Cairo, Egypt and group them by geographic area:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -38,7 +38,7 @@ Data must contain a unique identifier for each track. For example: `id` or `tid`
|
||||||
- Specify columns that uniquely identify each track or route with the `groupBy` parameter.
|
- Specify columns that uniquely identify each track or route with the `groupBy` parameter.
|
||||||
- Specify which columns to sort by with the `sortBy` parameter. Default is `["_time"]`.
|
- Specify which columns to sort by with the `sortBy` parameter. Default is `["_time"]`.
|
||||||
|
|
||||||
The following example uses the [sample bird migration data](/influxdb/v2/query-data/flux/geo/#sample-data)
|
The following example uses the [sample bird migration data](/influxdb/version/query-data/flux/geo/#sample-data)
|
||||||
to query data points within 200km of Cairo, Egypt and group them into routes unique
|
to query data points within 200km of Cairo, Egypt and group them into routes unique
|
||||||
to each bird:
|
to each bird:
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ Grid and S2 cell ID accuracy are defined by a [level](https://s2geometry.io/reso
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
To filter more quickly, use higher S2 Cell ID levels,
|
To filter more quickly, use higher S2 Cell ID levels,
|
||||||
but know that that higher levels increase [series cardinality](/influxdb/v2/reference/glossary/#series-cardinality).
|
but know that that higher levels increase [series cardinality](/influxdb/version/reference/glossary/#series-cardinality).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
The Geo package requires S2 cell IDs as tokens.
|
The Geo package requires S2 cell IDs as tokens.
|
||||||
|
|
|
@ -6,7 +6,7 @@ This guide walks through grouping data in Flux and provides examples of how data
|
||||||
If you're just getting started with Flux queries, check out the following:
|
If you're just getting started with Flux queries, check out the following:
|
||||||
|
|
||||||
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
||||||
- [Execute queries](/influxdb/v2/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
- [Execute queries](/influxdb/version/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
||||||
|
|
||||||
## Group keys
|
## Group keys
|
||||||
Every table has a **group key** – a list of columns for which every row in the table has the same value.
|
Every table has a **group key** – a list of columns for which every row in the table has the same value.
|
||||||
|
|
|
@ -5,7 +5,7 @@ This guide walks through using Flux's `histogram()` function to transform your d
|
||||||
If you're just getting started with Flux queries, check out the following:
|
If you're just getting started with Flux queries, check out the following:
|
||||||
|
|
||||||
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
||||||
- [Execute queries](/influxdb/v2/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
- [Execute queries](/influxdb/version/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
||||||
|
|
||||||
## histogram() function
|
## histogram() function
|
||||||
|
|
||||||
|
@ -51,12 +51,12 @@ logarithmicBins(start: 1.0, factor: 2.0, count: 10, infinity: true)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Histogram visualization
|
## Histogram visualization
|
||||||
The [Histogram visualization type](/influxdb/v2/visualize-data/visualization-types/histogram/)
|
The [Histogram visualization type](/influxdb/version/visualize-data/visualization-types/histogram/)
|
||||||
automatically converts query results into a binned and segmented histogram.
|
automatically converts query results into a binned and segmented histogram.
|
||||||
|
|
||||||
{{< img-hd src="/img/influxdb/2-0-visualizations-histogram-example.png" alt="Histogram visualization" />}}
|
{{< img-hd src="/img/influxdb/2-0-visualizations-histogram-example.png" alt="Histogram visualization" />}}
|
||||||
|
|
||||||
Use the [Histogram visualization controls](/influxdb/v2/visualize-data/visualization-types/histogram/#histogram-controls)
|
Use the [Histogram visualization controls](/influxdb/version/visualize-data/visualization-types/histogram/#histogram-controls)
|
||||||
to specify the number of bins and define groups in bins.
|
to specify the number of bins and define groups in bins.
|
||||||
|
|
||||||
### Histogram visualization data structure
|
### Histogram visualization data structure
|
||||||
|
|
|
@ -7,7 +7,7 @@ to "map" over data and transform values using mathematic operations.
|
||||||
If you're just getting started with Flux queries, check out the following:
|
If you're just getting started with Flux queries, check out the following:
|
||||||
|
|
||||||
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
||||||
- [Execute queries](/influxdb/v2/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
- [Execute queries](/influxdb/version/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
||||||
|
|
||||||
##### Basic mathematic operations
|
##### Basic mathematic operations
|
||||||
```js
|
```js
|
||||||
|
@ -22,7 +22,7 @@ If you're just getting started with Flux queries, check out the following:
|
||||||
3
|
3
|
||||||
```
|
```
|
||||||
|
|
||||||
<p style="font-size:.85rem;font-style:italic;margin-top:-2rem;">See <a href="/influxdb/v2/tools/flux-repl/">Flux Read-Eval-Print Loop (REPL)</a>.</p>
|
<p style="font-size:.85rem;font-style:italic;margin-top:-2rem;">See <a href="/influxdb/version/tools/flux-repl/">Flux Read-Eval-Print Loop (REPL)</a>.</p>
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
#### Operands must be the same type
|
#### Operands must be the same type
|
||||||
|
@ -53,7 +53,7 @@ For example:
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
## Custom mathematic functions
|
## Custom mathematic functions
|
||||||
Flux lets you [create custom functions](/influxdb/v2/query-data/flux/custom-functions) that use mathematic operations.
|
Flux lets you [create custom functions](/influxdb/version/query-data/flux/custom-functions) that use mathematic operations.
|
||||||
View the examples below.
|
View the examples below.
|
||||||
|
|
||||||
###### Custom multiplication function
|
###### Custom multiplication function
|
||||||
|
@ -75,7 +75,7 @@ percent(sample: 20.0, total: 80.0)
|
||||||
### Transform values in a data stream
|
### Transform values in a data stream
|
||||||
To transform multiple values in an input stream, your function needs to:
|
To transform multiple values in an input stream, your function needs to:
|
||||||
|
|
||||||
- [Handle piped-forward data](/influxdb/v2/query-data/flux/custom-functions/#use-piped-forward-data-in-a-custom-function).
|
- [Handle piped-forward data](/influxdb/version/query-data/flux/custom-functions/#use-piped-forward-data-in-a-custom-function).
|
||||||
- Each operand necessary for the calculation exists in each row _(see [Pivot vs join](#pivot-vs-join) below)_.
|
- Each operand necessary for the calculation exists in each row _(see [Pivot vs join](#pivot-vs-join) below)_.
|
||||||
- Use the [`map()` function](/flux/v0/stdlib/universe/map) to iterate over each row.
|
- Use the [`map()` function](/flux/v0/stdlib/universe/map) to iterate over each row.
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ To calculate a percentage, use simple division, then multiply the result by 100.
|
||||||
25.0
|
25.0
|
||||||
```
|
```
|
||||||
|
|
||||||
_For an in-depth look at calculating percentages, see [Calculate percentages](/influxdb/v2/query-data/flux/calculate-percentages)._
|
_For an in-depth look at calculating percentages, see [Calculate percentages](/influxdb/version/query-data/flux/calculate-percentages)._
|
||||||
|
|
||||||
## Pivot vs join
|
## Pivot vs join
|
||||||
To query and use values in mathematical operations in Flux, operand values must
|
To query and use values in mathematical operations in Flux, operand values must
|
||||||
|
|
|
@ -83,7 +83,7 @@ Output tables consist of a single row containing the calculated median.
|
||||||
{{< /flex >}}
|
{{< /flex >}}
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
The examples below use the [example data variable](/influxdb/v2/query-data/flux/#example-data-variable).
|
The examples below use the [example data variable](/influxdb/version/query-data/flux/#example-data-variable).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
## Find the value that represents the median
|
## Find the value that represents the median
|
||||||
|
@ -117,7 +117,7 @@ data
|
||||||
[`aggregateWindow()`](/flux/v0/stdlib/universe/aggregatewindow/)
|
[`aggregateWindow()`](/flux/v0/stdlib/universe/aggregatewindow/)
|
||||||
segments data into windows of time, aggregates data in each window into a single
|
segments data into windows of time, aggregates data in each window into a single
|
||||||
point, and then removes the time-based segmentation.
|
point, and then removes the time-based segmentation.
|
||||||
It is primarily used to [downsample data](/influxdb/v2/process-data/common-tasks/downsample-data/).
|
It is primarily used to [downsample data](/influxdb/version/process-data/common-tasks/downsample-data/).
|
||||||
|
|
||||||
To specify the [median calculation method](#select-a-method-for-calculating-the-median) in `aggregateWindow()`, use the
|
To specify the [median calculation method](#select-a-method-for-calculating-the-median) in `aggregateWindow()`, use the
|
||||||
[full function syntax](/flux/v0/stdlib/universe/aggregatewindow/#specify-parameters-of-the-aggregate-function):
|
[full function syntax](/flux/v0/stdlib/universe/aggregatewindow/#specify-parameters-of-the-aggregate-function):
|
||||||
|
|
|
@ -8,7 +8,7 @@ Flux helps you monitor states in your metrics and events:
|
||||||
If you're just getting started with Flux queries, check out the following:
|
If you're just getting started with Flux queries, check out the following:
|
||||||
|
|
||||||
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux.
|
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux.
|
||||||
- [Execute queries](/influxdb/v2/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
- [Execute queries](/influxdb/version/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
||||||
|
|
||||||
## Find how long a state persists
|
## Find how long a state persists
|
||||||
|
|
||||||
|
@ -122,13 +122,13 @@ from(bucket: "servers")
|
||||||
|
|
||||||
<!--## Detect state changes
|
<!--## Detect state changes
|
||||||
|
|
||||||
Detect state changes with the `monitor.stateChanges()` function. To use the `monitor.stateChanges()` function, set up a **check** to query data (stored in the `_monitoring` bucket > `statuses` measurement > `_level` column; see [Monitor data and send alerts](/influxdb/v2/monitor-alert/) for more detail.
|
Detect state changes with the `monitor.stateChanges()` function. To use the `monitor.stateChanges()` function, set up a **check** to query data (stored in the `_monitoring` bucket > `statuses` measurement > `_level` column; see [Monitor data and send alerts](/influxdb/version/monitor-alert/) for more detail.
|
||||||
|
|
||||||
1. In the InfluxDB user interface, click the **Monitoring and Alerting** icon from the sidebar.
|
1. In the InfluxDB user interface, click the **Monitoring and Alerting** icon from the sidebar.
|
||||||
|
|
||||||
{{< nav-icon "alerts" >}}
|
{{< nav-icon "alerts" >}}
|
||||||
|
|
||||||
2. If you haven't already, [create a check](/influxdb/v2/monitor-alert/checks/create/) that stores statuses (`CRIT`, `WARN`, `INFO`, `OK` or `ANY`) in the `_level` column. <!-- specify how to do this with monitor.check() function or in UI, with check threshold or deadman?
|
2. If you haven't already, [create a check](/influxdb/version/monitor-alert/checks/create/) that stores statuses (`CRIT`, `WARN`, `INFO`, `OK` or `ANY`) in the `_level` column. <!-- specify how to do this with monitor.check() function or in UI, with check threshold or deadman?
|
||||||
3. Import the InfluxDB `monitor` package.
|
3. Import the InfluxDB `monitor` package.
|
||||||
4. In your query, the specify the check. <!--can users specify a Flux query with the `monitoring` bucket and _level field without specifying the check? does importing the monitor package create the `monitoring` bucket?
|
4. In your query, the specify the check. <!--can users specify a Flux query with the `monitoring` bucket and _level field without specifying the check? does importing the monitor package create the `monitoring` bucket?
|
||||||
5. Use the `monitor.stateChanges()` function and include the following information:
|
5. Use the `monitor.stateChanges()` function and include the following information:
|
||||||
|
|
|
@ -12,7 +12,7 @@ Use Flux to process and operate on timestamps to suit your needs.
|
||||||
If you're just getting started with Flux queries, check out the following:
|
If you're just getting started with Flux queries, check out the following:
|
||||||
|
|
||||||
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
||||||
- [Execute queries](/influxdb/v2/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
- [Execute queries](/influxdb/version/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ If you're just getting started with Flux queries, check out the following:
|
||||||
|
|
||||||
### Unix nanosecond to RFC3339
|
### Unix nanosecond to RFC3339
|
||||||
Use the [`time()` function](/flux/v0/stdlib/universe/time/)
|
Use the [`time()` function](/flux/v0/stdlib/universe/time/)
|
||||||
to convert a [Unix **nanosecond** timestamp](/influxdb/v2/reference/glossary/#unix-timestamp)
|
to convert a [Unix **nanosecond** timestamp](/influxdb/version/reference/glossary/#unix-timestamp)
|
||||||
to an [RFC3339 timestamp](/influxdb/v2/reference/glossary/#rfc3339-timestamp).
|
to an [RFC3339 timestamp](/influxdb/version/reference/glossary/#rfc3339-timestamp).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
time(v: 1568808000000000000)
|
time(v: 1568808000000000000)
|
||||||
|
|
|
@ -95,7 +95,7 @@ If calculating the `0.5` quantile or 50th percentile:
|
||||||
{{< /flex >}}
|
{{< /flex >}}
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
The examples below use the [example data variable](/influxdb/v2/query-data/flux/#example-data-variable).
|
The examples below use the [example data variable](/influxdb/version/query-data/flux/#example-data-variable).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
## Find the value representing the 99th percentile
|
## Find the value representing the 99th percentile
|
||||||
|
@ -131,7 +131,7 @@ data
|
||||||
[`aggregateWindow()`](/flux/v0/stdlib/universe/aggregatewindow/)
|
[`aggregateWindow()`](/flux/v0/stdlib/universe/aggregatewindow/)
|
||||||
segments data into windows of time, aggregates data in each window into a single
|
segments data into windows of time, aggregates data in each window into a single
|
||||||
point, and then removes the time-based segmentation.
|
point, and then removes the time-based segmentation.
|
||||||
It is primarily used to [downsample data](/influxdb/v2/process-data/common-tasks/downsample-data/).
|
It is primarily used to [downsample data](/influxdb/version/process-data/common-tasks/downsample-data/).
|
||||||
|
|
||||||
To specify the [quantile calculation method](#select-a-method-for-calculating-the-quantile) in
|
To specify the [quantile calculation method](#select-a-method-for-calculating-the-quantile) in
|
||||||
`aggregateWindow()`, use the [full function syntax](/flux/v0/stdlib/universe/aggregatewindow/#specify-parameters-of-the-aggregate-function):
|
`aggregateWindow()`, use the [full function syntax](/flux/v0/stdlib/universe/aggregatewindow/#specify-parameters-of-the-aggregate-function):
|
||||||
|
|
|
@ -5,8 +5,8 @@ to query data based on fields, tags, or any other column value.
|
||||||
clause in InfluxQL and other SQL-like query languages.
|
clause in InfluxQL and other SQL-like query languages.
|
||||||
|
|
||||||
## The filter() function
|
## The filter() function
|
||||||
`filter()` has an `fn` parameter that expects a [predicate function](/influxdb/v2/reference/glossary/#predicate-function),
|
`filter()` has an `fn` parameter that expects a [predicate function](/influxdb/version/reference/glossary/#predicate-function),
|
||||||
an anonymous function comprised of one or more [predicate expressions](/influxdb/v2/reference/glossary/#predicate-expression).
|
an anonymous function comprised of one or more [predicate expressions](/influxdb/version/reference/glossary/#predicate-expression).
|
||||||
The predicate function evaluates each input row.
|
The predicate function evaluates each input row.
|
||||||
Rows that evaluate to `true` are **included** in the output data.
|
Rows that evaluate to `true` are **included** in the output data.
|
||||||
Rows that evaluate to `false` are **excluded** from the output data.
|
Rows that evaluate to `false` are **excluded** from the output data.
|
||||||
|
@ -40,7 +40,7 @@ The combination of [`from()`](/flux/v0/stdlib/influxdata/influxdb/from),
|
||||||
[`range()`](/flux/v0/stdlib/universe/range),
|
[`range()`](/flux/v0/stdlib/universe/range),
|
||||||
and `filter()` represent the most basic Flux query:
|
and `filter()` represent the most basic Flux query:
|
||||||
|
|
||||||
1. Use `from()` to define your [bucket](/influxdb/v2/reference/glossary/#bucket).
|
1. Use `from()` to define your [bucket](/influxdb/version/reference/glossary/#bucket).
|
||||||
2. Use `range()` to limit query results by time.
|
2. Use `range()` to limit query results by time.
|
||||||
3. Use `filter()` to identify what rows of data to output.
|
3. Use `filter()` to identify what rows of data to output.
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ This guide shows how to use regular expressions in your Flux scripts.
|
||||||
If you're just getting started with Flux queries, check out the following:
|
If you're just getting started with Flux queries, check out the following:
|
||||||
|
|
||||||
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
||||||
- [Execute queries](/influxdb/v2/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
- [Execute queries](/influxdb/version/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
||||||
|
|
||||||
## Go regular expression syntax
|
## Go regular expression syntax
|
||||||
Flux uses Go's [regexp package](https://golang.org/pkg/regexp/) for regular expression search.
|
Flux uses Go's [regexp package](https://golang.org/pkg/regexp/) for regular expression search.
|
||||||
|
|
|
@ -7,7 +7,7 @@ to limit the number of records in output tables to a fixed number, `n`.
|
||||||
If you're just getting started with Flux queries, check out the following:
|
If you're just getting started with Flux queries, check out the following:
|
||||||
|
|
||||||
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
||||||
- [Execute queries](/influxdb/v2/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
- [Execute queries](/influxdb/version/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
||||||
|
|
||||||
##### Example sorting system uptime
|
##### Example sorting system uptime
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
The [Flux](/influxdb/v2/reference/flux) `sql` package provides functions for working with SQL data sources.
|
The [Flux](/influxdb/version/reference/flux) `sql` package provides functions for working with SQL data sources.
|
||||||
[`sql.from()`](/flux/v0/stdlib/sql/from/) lets you query SQL data sources
|
[`sql.from()`](/flux/v0/stdlib/sql/from/) lets you query SQL data sources
|
||||||
like [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/),
|
like [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/),
|
||||||
[Snowflake](https://www.snowflake.com/), [SQLite](https://www.sqlite.org/index.html),
|
[Snowflake](https://www.snowflake.com/), [SQLite](https://www.sqlite.org/index.html),
|
||||||
|
@ -16,7 +16,7 @@ and use the results with InfluxDB dashboards, tasks, and other operations.
|
||||||
If you're just getting started with Flux queries, check out the following:
|
If you're just getting started with Flux queries, check out the following:
|
||||||
|
|
||||||
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
||||||
- [Execute queries](/influxdb/v2/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
- [Execute queries](/influxdb/version/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
||||||
|
|
||||||
## Query a SQL data source
|
## Query a SQL data source
|
||||||
To query a SQL data source:
|
To query a SQL data source:
|
||||||
|
@ -164,7 +164,7 @@ join(tables: {metric: sensorMetrics, info: sensorInfo}, on: ["sensor_id"])
|
||||||
```
|
```
|
||||||
|
|
||||||
## Use SQL results to populate dashboard variables
|
## Use SQL results to populate dashboard variables
|
||||||
Use `sql.from()` to [create dashboard variables](/influxdb/v2/visualize-data/variables/create-variable/)
|
Use `sql.from()` to [create dashboard variables](/influxdb/version/visualize-data/variables/create-variable/)
|
||||||
from SQL query results.
|
from SQL query results.
|
||||||
The following example uses the [air sensor sample data](#sample-sensor-data) below to
|
The following example uses the [air sensor sample data](#sample-sensor-data) below to
|
||||||
create a variable that lets you select the location of a sensor.
|
create a variable that lets you select the location of a sensor.
|
||||||
|
@ -188,13 +188,13 @@ Use the variable to manipulate queries in your dashboards.
|
||||||
---
|
---
|
||||||
|
|
||||||
## Use secrets to store SQL database credentials
|
## Use secrets to store SQL database credentials
|
||||||
If your SQL database requires authentication, use [InfluxDB secrets](/influxdb/v2/admin/secrets/)
|
If your SQL database requires authentication, use [InfluxDB secrets](/influxdb/version/admin/secrets/)
|
||||||
to store and populate connection credentials.
|
to store and populate connection credentials.
|
||||||
By default, InfluxDB base64-encodes and stores secrets in its internal key-value store, BoltDB.
|
By default, InfluxDB base64-encodes and stores secrets in its internal key-value store, BoltDB.
|
||||||
For added security, [store secrets in Vault](/influxdb/v2/admin/secrets/use-vault/).
|
For added security, [store secrets in Vault](/influxdb/version/admin/secrets/use-vault/).
|
||||||
|
|
||||||
### Store your database credentials as secrets
|
### Store your database credentials as secrets
|
||||||
Use the [InfluxDB API](/influxdb/v2/reference/api/) or the [`influx` CLI](/influxdb/v2/reference/cli/influx/secret/)
|
Use the [InfluxDB API](/influxdb/version/reference/api/) or the [`influx` CLI](/influxdb/version/reference/cli/influx/secret/)
|
||||||
to store your database credentials as secrets.
|
to store your database credentials as secrets.
|
||||||
|
|
||||||
{{< tabs-wrapper >}}
|
{{< tabs-wrapper >}}
|
||||||
|
@ -216,8 +216,8 @@ curl --request PATCH http://localhost:8086/api/v2/orgs/<org-id>/secrets \
|
||||||
|
|
||||||
**To store secrets, you need:**
|
**To store secrets, you need:**
|
||||||
|
|
||||||
- [your organization ID](/influxdb/v2/admin/organizations/view-orgs/#view-your-organization-id)
|
- [your organization ID](/influxdb/version/admin/organizations/view-orgs/#view-your-organization-id)
|
||||||
- [your API token](/influxdb/v2/admin/tokens/view-tokens/)
|
- [your API token](/influxdb/version/admin/tokens/view-tokens/)
|
||||||
{{% /tab-content %}}
|
{{% /tab-content %}}
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
```sh
|
```sh
|
||||||
|
@ -286,8 +286,8 @@ Sample sensor information is stored in PostgreSQL.
|
||||||
|
|
||||||
#### Download sample air sensor data
|
#### Download sample air sensor data
|
||||||
|
|
||||||
1. [Create a bucket](/influxdb/v2/admin/buckets/create-bucket/) to store the data.
|
1. [Create a bucket](/influxdb/version/admin/buckets/create-bucket/) to store the data.
|
||||||
2. [Create an InfluxDB task](/influxdb/v2/process-data/manage-tasks/create-task/)
|
2. [Create an InfluxDB task](/influxdb/version/process-data/manage-tasks/create-task/)
|
||||||
and use the [`sample.data()` function](/flux/v0/stdlib/influxdata/influxdb/sample/data/)
|
and use the [`sample.data()` function](/flux/v0/stdlib/influxdata/influxdb/sample/data/)
|
||||||
to download sample air sensor data every 15 minutes.
|
to download sample air sensor data every 15 minutes.
|
||||||
Write the downloaded sample data to your new bucket:
|
Write the downloaded sample data to your new bucket:
|
||||||
|
@ -301,7 +301,7 @@ Sample sensor information is stored in PostgreSQL.
|
||||||
|> to(org: "example-org", bucket: "example-bucket")
|
|> to(org: "example-org", bucket: "example-bucket")
|
||||||
```
|
```
|
||||||
|
|
||||||
3. [Query your target bucket](/influxdb/v2/query-data/execute-queries/) after
|
3. [Query your target bucket](/influxdb/version/query-data/execute-queries/) after
|
||||||
the first task run to ensure the sample data is writing successfully.
|
the first task run to ensure the sample data is writing successfully.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -346,4 +346,4 @@ Download and import the Air Sensors dashboard to visualize the generated data:
|
||||||
|
|
||||||
<a class="btn github" href="https://raw.githubusercontent.com/influxdata/influxdb2-sample-data/master/air-sensor-data/air-sensors-dashboard.json" target="_blank">View Air Sensors dashboard JSON</a>
|
<a class="btn github" href="https://raw.githubusercontent.com/influxdata/influxdb2-sample-data/master/air-sensor-data/air-sensors-dashboard.json" target="_blank">View Air Sensors dashboard JSON</a>
|
||||||
|
|
||||||
_For information about importing a dashboard, see [Create a dashboard](/influxdb/v2/visualize-data/dashboards/create-dashboard)._
|
_For information about importing a dashboard, see [Create a dashboard](/influxdb/version/visualize-data/dashboards/create-dashboard)._
|
||||||
|
|
|
@ -7,7 +7,7 @@ how data is shaped in the process.
|
||||||
If you're just getting started with Flux queries, check out the following:
|
If you're just getting started with Flux queries, check out the following:
|
||||||
|
|
||||||
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
- [Get started with Flux](/flux/v0/get-started/) for a conceptual overview of Flux and parts of a Flux query.
|
||||||
- [Execute queries](/influxdb/v2/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
- [Execute queries](/influxdb/version/query-data/execute-queries/) to discover a variety of ways to run your queries.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
The following example is an in-depth walk-through of the steps required to window and aggregate data.
|
The following example is an in-depth walk-through of the steps required to window and aggregate data.
|
||||||
|
|
|
@ -6,7 +6,7 @@ These guides walks through important concepts related to Flux and querying time
|
||||||
series data from InfluxDB using Flux.
|
series data from InfluxDB using Flux.
|
||||||
|
|
||||||
## Tools for working with Flux
|
## Tools for working with Flux
|
||||||
The [Execute queries](/influxdb/v2/query-data/execute-queries) guide walks through
|
The [Execute queries](/influxdb/version/query-data/execute-queries) guide walks through
|
||||||
the different tools available for querying InfluxDB with Flux.
|
the different tools available for querying InfluxDB with Flux.
|
||||||
|
|
||||||
## Before you start
|
## Before you start
|
||||||
|
@ -14,4 +14,4 @@ To get a basic understanding of the Flux data model and syntax, see
|
||||||
[Get started with Flux](/flux/v0/get-started/) in the
|
[Get started with Flux](/flux/v0/get-started/) in the
|
||||||
[Flux documentation](/flux/v0/).
|
[Flux documentation](/flux/v0/).
|
||||||
|
|
||||||
{{< page-nav next="/influxdb/v2/query-data/get-started/query-influxdb/" >}}
|
{{< page-nav next="/influxdb/version/query-data/get-started/query-influxdb/" >}}
|
||||||
|
|
|
@ -114,4 +114,4 @@ You have now queried data from InfluxDB using Flux.
|
||||||
The query shown here is a basic example.
|
The query shown here is a basic example.
|
||||||
Flux queries can be extended in many ways to form powerful scripts.
|
Flux queries can be extended in many ways to form powerful scripts.
|
||||||
|
|
||||||
{{< page-nav prev="/influxdb/v2/query-data/get-started/" next="/influxdb/v2/query-data/get-started/transform-data/" >}}
|
{{< page-nav prev="/influxdb/version/query-data/get-started/" next="/influxdb/version/query-data/get-started/transform-data/" >}}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
When [querying data from InfluxDB](/influxdb/v2/query-data/get-started/query-influxdb),
|
When [querying data from InfluxDB](/influxdb/version/query-data/get-started/query-influxdb),
|
||||||
you often need to transform that data in some way.
|
you often need to transform that data in some way.
|
||||||
Common examples are aggregating data, downsampling data, etc.
|
Common examples are aggregating data, downsampling data, etc.
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ If you're not familiar with how Flux structures and operates on data, see
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
## Query data
|
## Query data
|
||||||
Use the query built in the previous [Query data from InfluxDB](/influxdb/v2/query-data/get-started/query-influxdb)
|
Use the query built in the previous [Query data from InfluxDB](/influxdb/version/query-data/get-started/query-influxdb)
|
||||||
guide, but update the range to pull data from the last hour:
|
guide, but update the range to pull data from the last hour:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -24,7 +24,7 @@ from(bucket: "example-bucket")
|
||||||
|
|
||||||
## Flux functions
|
## Flux functions
|
||||||
Flux provides a number of functions that perform specific operations, transformations, and tasks.
|
Flux provides a number of functions that perform specific operations, transformations, and tasks.
|
||||||
You can also [create custom functions](/influxdb/v2/query-data/flux/custom-functions) in your Flux queries.
|
You can also [create custom functions](/influxdb/version/query-data/flux/custom-functions) in your Flux queries.
|
||||||
_Functions are covered in detail in the [Flux standard library](/flux/v0/stdlib/) documentation._
|
_Functions are covered in detail in the [Flux standard library](/flux/v0/stdlib/) documentation._
|
||||||
|
|
||||||
A common type of function used when transforming data queried from InfluxDB is an aggregate function.
|
A common type of function used when transforming data queried from InfluxDB is an aggregate function.
|
||||||
|
@ -142,8 +142,8 @@ and your own custom functions, but this is a good introduction into the basic sy
|
||||||
---
|
---
|
||||||
|
|
||||||
_For a deeper dive into windowing and aggregating data with example data output for each transformation,
|
_For a deeper dive into windowing and aggregating data with example data output for each transformation,
|
||||||
view the [Window and aggregate data](/influxdb/v2/query-data/flux/window-aggregate) guide._
|
view the [Window and aggregate data](/influxdb/version/query-data/flux/window-aggregate) guide._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
{{< page-nav prev="/influxdb/v2/query-data/get-started/query-influxdb/" >}}
|
{{< page-nav prev="/influxdb/version/query-data/get-started/query-influxdb/" >}}
|
||||||
|
|
|
@ -3,7 +3,7 @@ Use InfluxQL (an SQL-like query language) to interact with InfluxDB, and query a
|
||||||
|
|
||||||
In InfluxDB 1.x, data is stored in [databases](/influxdb/v1/concepts/glossary/#database)
|
In InfluxDB 1.x, data is stored in [databases](/influxdb/v1/concepts/glossary/#database)
|
||||||
and [retention policies](/influxdb/v1/concepts/glossary/#retention-policy-rp).
|
and [retention policies](/influxdb/v1/concepts/glossary/#retention-policy-rp).
|
||||||
In InfluxDB OSS {{< current-version >}}, data is stored in [buckets](/influxdb/v2/reference/glossary/#bucket).
|
In InfluxDB OSS {{< current-version >}}, data is stored in [buckets](/influxdb/version/reference/glossary/#bucket).
|
||||||
Because InfluxQL uses the 1.x data model, a bucket must be mapped to a database and retention policy (DBRP) before it can be queried using InfluxQL.
|
Because InfluxQL uses the 1.x data model, a bucket must be mapped to a database and retention policy (DBRP) before it can be queried using InfluxQL.
|
||||||
|
|
||||||
**To query data with InfluxQL, complete the following steps:**
|
**To query data with InfluxQL, complete the following steps:**
|
||||||
|
@ -17,22 +17,22 @@ Because InfluxQL uses the 1.x data model, a bucket must be mapped to a database
|
||||||
#### InfluxQL reference documentation
|
#### InfluxQL reference documentation
|
||||||
|
|
||||||
For complete InfluxQL reference documentation, see the
|
For complete InfluxQL reference documentation, see the
|
||||||
[InfluxQL specification for InfluxDB 2.x](/influxdb/v2/reference/syntax/influxql/spec/).
|
[InfluxQL specification for InfluxDB 2.x](/influxdb/version/reference/syntax/influxql/spec/).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
## Verify buckets have a mapping
|
## Verify buckets have a mapping
|
||||||
|
|
||||||
1. To verify the buckets you want to query are mapped to a database and retention policy, use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) or the [InfluxDB API](/influxdb/v2/reference/api/).
|
1. To verify the buckets you want to query are mapped to a database and retention policy, use the [`influx` CLI](/influxdb/version/reference/cli/influx/) or the [InfluxDB API](/influxdb/version/reference/api/).
|
||||||
_For examples, see [List DBRP mappings](/influxdb/v2/query-data/influxql/dbrp/#list-dbrp-mappings)._
|
_For examples, see [List DBRP mappings](/influxdb/version/query-data/influxql/dbrp/#list-dbrp-mappings)._
|
||||||
|
|
||||||
2. If you **do not find a DBRP mapping for a bucket**, [create a new DBRP mapping](/influxdb/v2/query-data/influxql/dbrp/#create-dbrp-mappings) to
|
2. If you **do not find a DBRP mapping for a bucket**, [create a new DBRP mapping](/influxdb/version/query-data/influxql/dbrp/#create-dbrp-mappings) to
|
||||||
map the unmapped bucket.
|
map the unmapped bucket.
|
||||||
|
|
||||||
## Create DBRP mappings for unmapped buckets
|
## Create DBRP mappings for unmapped buckets
|
||||||
|
|
||||||
- Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) or the [InfluxDB API](/influxdb/v2/reference/api/)
|
- Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) or the [InfluxDB API](/influxdb/version/reference/api/)
|
||||||
to manually create DBRP mappings for unmapped buckets.
|
to manually create DBRP mappings for unmapped buckets.
|
||||||
_For examples, see [Create DBRP mappings](/influxdb/v2/query-data/influxql/dbrp/#create-dbrp-mappings)._
|
_For examples, see [Create DBRP mappings](/influxdb/version/query-data/influxql/dbrp/#create-dbrp-mappings)._
|
||||||
|
|
||||||
## Query a mapped bucket with InfluxQL
|
## Query a mapped bucket with InfluxQL
|
||||||
|
|
||||||
|
@ -44,12 +44,12 @@ _For examples, see [Create DBRP mappings](/influxdb/v2/query-data/influxql/dbrp/
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
<!---------------------------- BEGIN InfluxQL shell --------------------------->
|
<!---------------------------- BEGIN InfluxQL shell --------------------------->
|
||||||
|
|
||||||
The [`influx` CLI](/influxdb/v2/reference/cli/influx/) provides an [InfluxQL shell](/influxdb/v2/tools/influxql-shell/) where you can execute InfluxQL queries in an interactive Read-Eval-Print-Loop (REPL).
|
The [`influx` CLI](/influxdb/version/reference/cli/influx/) provides an [InfluxQL shell](/influxdb/version/tools/influxql-shell/) where you can execute InfluxQL queries in an interactive Read-Eval-Print-Loop (REPL).
|
||||||
|
|
||||||
1. If you haven't already, do the following:
|
1. If you haven't already, do the following:
|
||||||
|
|
||||||
- [Download and install the `influx` CLI](/influxdb/v2/tools/influx-cli/#install-the-influx-cli)
|
- [Download and install the `influx` CLI](/influxdb/version/tools/influx-cli/#install-the-influx-cli)
|
||||||
- [Configure your authentication credentials](/influxdb/v2/tools/influx-cli/#provide-required-authentication-credentials)
|
- [Configure your authentication credentials](/influxdb/version/tools/influx-cli/#provide-required-authentication-credentials)
|
||||||
|
|
||||||
2. Use the following command to start an InfluxQL shell:
|
2. Use the following command to start an InfluxQL shell:
|
||||||
|
|
||||||
|
@ -63,21 +63,21 @@ The [`influx` CLI](/influxdb/v2/reference/cli/influx/) provides an [InfluxQL she
|
||||||
SELECT used_percent FROM "example-db"."example-rp"."example-measurement" WHERE host=host1
|
SELECT used_percent FROM "example-db"."example-rp"."example-measurement" WHERE host=host1
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information, see how to [use the InfluxQL shell](/influxdb/v2/tools/influxql-shell/). For more information about DBRP mappings, see [Manage DBRP mappings](/influxdb/v2/query-data/influxql/dbrp/).
|
For more information, see how to [use the InfluxQL shell](/influxdb/version/tools/influxql-shell/). For more information about DBRP mappings, see [Manage DBRP mappings](/influxdb/version/query-data/influxql/dbrp/).
|
||||||
|
|
||||||
<!----------------------------- END InfluxQL shell ---------------------------->
|
<!----------------------------- END InfluxQL shell ---------------------------->
|
||||||
{{% /tab-content %}}
|
{{% /tab-content %}}
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
<!----------------------------- BEGIN InfluxDB API ---------------------------->
|
<!----------------------------- BEGIN InfluxDB API ---------------------------->
|
||||||
|
|
||||||
The [InfluxDB 1.x compatibility API](/influxdb/v2/reference/api/influxdb-1x/) supports
|
The [InfluxDB 1.x compatibility API](/influxdb/version/reference/api/influxdb-1x/) supports
|
||||||
all InfluxDB 1.x client libraries and integrations in InfluxDB {{< current-version >}}.
|
all InfluxDB 1.x client libraries and integrations in InfluxDB {{< current-version >}}.
|
||||||
|
|
||||||
1. To query a mapped bucket with InfluxQL, use the [`/query` 1.x compatibility endpoint](/influxdb/v2/reference/api/influxdb-1x/query/), and include the following in your request:
|
1. To query a mapped bucket with InfluxQL, use the [`/query` 1.x compatibility endpoint](/influxdb/version/reference/api/influxdb-1x/query/), and include the following in your request:
|
||||||
|
|
||||||
- **Request method:** `GET`
|
- **Request method:** `GET`
|
||||||
- **Headers:**
|
- **Headers:**
|
||||||
- **Authorization:** _See [compatibility API authentication](/influxdb/v2/reference/api/influxdb-1x/#authentication)_
|
- **Authorization:** _See [compatibility API authentication](/influxdb/version/reference/api/influxdb-1x/#authentication)_
|
||||||
- **Query parameters:**
|
- **Query parameters:**
|
||||||
- **db**: 1.x database to query
|
- **db**: 1.x database to query
|
||||||
- **rp**: 1.x retention policy to query _(if no retention policy is specified, InfluxDB uses the default retention policy for the specified database)_
|
- **rp**: 1.x retention policy to query _(if no retention policy is specified, InfluxDB uses the default retention policy for the specified database)_
|
||||||
|
@ -95,7 +95,7 @@ all InfluxDB 1.x client libraries and integrations in InfluxDB {{< current-versi
|
||||||
|
|
||||||
2. (Optional) To return results as **CSV**, include the `Accept: application/csv` header.
|
2. (Optional) To return results as **CSV**, include the `Accept: application/csv` header.
|
||||||
|
|
||||||
For more information about DBRP mappings, see [Manage DBRP mappings](/influxdb/v2/query-data/influxql/dbrp/).
|
For more information about DBRP mappings, see [Manage DBRP mappings](/influxdb/version/query-data/influxql/dbrp/).
|
||||||
<!------------------------------ END InfluxDB API ----------------------------->
|
<!------------------------------ END InfluxDB API ----------------------------->
|
||||||
{{% /tab-content %}}
|
{{% /tab-content %}}
|
||||||
{{< /tabs-wrapper >}}
|
{{< /tabs-wrapper >}}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
InfluxQL requires a database and retention policy (DBRP) combination in order to query data.
|
InfluxQL requires a database and retention policy (DBRP) combination in order to query data.
|
||||||
In InfluxDB {{< current-version >}}, databases and retention policies have been
|
In InfluxDB {{< current-version >}}, databases and retention policies have been
|
||||||
combined and replaced by InfluxDB [buckets](/influxdb/v2/reference/glossary/#bucket).
|
combined and replaced by InfluxDB [buckets](/influxdb/version/reference/glossary/#bucket).
|
||||||
To query InfluxDB {{< current-version >}} with InfluxQL, the specified DBRP
|
To query InfluxDB {{< current-version >}} with InfluxQL, the specified DBRP
|
||||||
combination must be mapped to a bucket.
|
combination must be mapped to a bucket.
|
||||||
|
|
||||||
|
@ -17,12 +17,12 @@ combination must be mapped to a bucket.
|
||||||
InfluxDB {{< current-version >}} will automatically create DBRP mappings for you
|
InfluxDB {{< current-version >}} will automatically create DBRP mappings for you
|
||||||
during the following operations:
|
during the following operations:
|
||||||
|
|
||||||
- Writing to the [`/write` v1 compatibility endpoint](/influxdb/v2/reference/api/influxdb-1x/write/)
|
- Writing to the [`/write` v1 compatibility endpoint](/influxdb/version/reference/api/influxdb-1x/write/)
|
||||||
{{% show-in "cloud,cloud-serverless" %}}- [Upgrading from InfluxDB 1.x to InfluxDB Cloud](/influxdb/v2/upgrade/v1-to-cloud/){{% /show-in %}}
|
{{% show-in "cloud,cloud-serverless" %}}- [Upgrading from InfluxDB 1.x to InfluxDB Cloud](/influxdb/version/upgrade/v1-to-cloud/){{% /show-in %}}
|
||||||
{{% show-in "v2" %}}- [Upgrading from InfluxDB 1.x to {{< current-version noSpan=true >}}](/influxdb/v2/upgrade/v1-to-v2/){{% /show-in %}}
|
{{% show-in "v2" %}}- [Upgrading from InfluxDB 1.x to {{< current-version noSpan=true >}}](/influxdb/version/upgrade/v1-to-v2/){{% /show-in %}}
|
||||||
{{% show-in "v2" %}}- Creating a bucket ([virtual DBRPs](#virtual-dbrp-mappings)){{% /show-in %}}
|
{{% show-in "v2" %}}- Creating a bucket ([virtual DBRPs](#virtual-dbrp-mappings)){{% /show-in %}}
|
||||||
|
|
||||||
For more information, see [Database and retention policy mapping](/influxdb/v2/reference/api/influxdb-1x/dbrp/).
|
For more information, see [Database and retention policy mapping](/influxdb/version/reference/api/influxdb-1x/dbrp/).
|
||||||
|
|
||||||
{{% show-in "v2" %}}
|
{{% show-in "v2" %}}
|
||||||
|
|
||||||
|
@ -37,14 +37,14 @@ Virtual DBRP mappings are read-only.
|
||||||
To override a virtual DBRP mapping, [create an explicit mapping](#create-dbrp-mappings).
|
To override a virtual DBRP mapping, [create an explicit mapping](#create-dbrp-mappings).
|
||||||
|
|
||||||
For information about how virtual DBRP mappings are created, see
|
For information about how virtual DBRP mappings are created, see
|
||||||
[Database and retention policy mapping – When creating a bucket](/influxdb/v2/reference/api/influxdb-1x/dbrp/#when-creating-a-bucket).
|
[Database and retention policy mapping – When creating a bucket](/influxdb/version/reference/api/influxdb-1x/dbrp/#when-creating-a-bucket).
|
||||||
|
|
||||||
{{% /show-in %}}
|
{{% /show-in %}}
|
||||||
|
|
||||||
## Create DBRP mappings
|
## Create DBRP mappings
|
||||||
|
|
||||||
Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) or the
|
Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) or the
|
||||||
[InfluxDB API](/influxdb/v2/reference/api/) to create DBRP mappings.
|
[InfluxDB API](/influxdb/version/reference/api/) to create DBRP mappings.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
#### A DBRP combination can only be mapped to a single bucket
|
#### A DBRP combination can only be mapped to a single bucket
|
||||||
|
@ -60,16 +60,16 @@ it will overwrite the existing DBRP mapping.
|
||||||
{{% /tabs %}}
|
{{% /tabs %}}
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
|
|
||||||
Use the [`influx v1 dbrp create` command](/influxdb/v2/reference/cli/influx/v1/dbrp/create/)
|
Use the [`influx v1 dbrp create` command](/influxdb/version/reference/cli/influx/v1/dbrp/create/)
|
||||||
to map an unmapped bucket to a database and retention policy.
|
to map an unmapped bucket to a database and retention policy.
|
||||||
Include the following:
|
Include the following:
|
||||||
|
|
||||||
{{< req type="key" >}}
|
{{< req type="key" >}}
|
||||||
|
|
||||||
- {{< req "\*" >}} **org** and **token** to authenticate. We recommend setting your organization and token to your active InfluxDB connection configuration in the influx CLI, so you don't have to add these parameters to each command. To set up your active InfluxDB configuration, see [`influx config set`](/influxdb/v2/reference/cli/influx/config/set/).
|
- {{< req "\*" >}} **org** and **token** to authenticate. We recommend setting your organization and token to your active InfluxDB connection configuration in the influx CLI, so you don't have to add these parameters to each command. To set up your active InfluxDB configuration, see [`influx config set`](/influxdb/version/reference/cli/influx/config/set/).
|
||||||
- {{< req "\*" >}} **database name** to map
|
- {{< req "\*" >}} **database name** to map
|
||||||
- {{< req "\*" >}} **retention policy** name to map
|
- {{< req "\*" >}} **retention policy** name to map
|
||||||
- {{< req "\*" >}} [Bucket ID](/influxdb/v2/admin/buckets/view-buckets/#view-buckets-in-the-influxdb-ui) to map to
|
- {{< req "\*" >}} [Bucket ID](/influxdb/version/admin/buckets/view-buckets/#view-buckets-in-the-influxdb-ui) to map to
|
||||||
- **Default flag** to set the provided retention policy as the default retention policy for the database
|
- **Default flag** to set the provided retention policy as the default retention policy for the database
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -83,22 +83,22 @@ influx v1 dbrp create \
|
||||||
{{% /tab-content %}}
|
{{% /tab-content %}}
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
|
|
||||||
Use the [`/api/v2/dbrps` API endpoint](/influxdb/v2/api/#operation/PostDBRP) to create a new DBRP mapping.
|
Use the [`/api/v2/dbrps` API endpoint](/influxdb/version/api/#operation/PostDBRP) to create a new DBRP mapping.
|
||||||
|
|
||||||
{{< api-endpoint endpoint="http://localhost:8086/api/v2/dbrps" method="POST" api-ref="/influxdb/v2/api/#operation/PostDBRP" >}}
|
{{< api-endpoint endpoint="http://localhost:8086/api/v2/dbrps" method="POST" api-ref="/influxdb/version/api/#operation/PostDBRP" >}}
|
||||||
|
|
||||||
Include the following:
|
Include the following:
|
||||||
|
|
||||||
- **Request method:** `POST`
|
- **Request method:** `POST`
|
||||||
- **Headers:**
|
- **Headers:**
|
||||||
- **Authorization:** `Token` schema with your InfluxDB [API token](/influxdb/v2/admin/tokens/)
|
- **Authorization:** `Token` schema with your InfluxDB [API token](/influxdb/version/admin/tokens/)
|
||||||
- **Content-type:** `application/json`
|
- **Content-type:** `application/json`
|
||||||
- **Request body:** JSON object with the following fields:
|
- **Request body:** JSON object with the following fields:
|
||||||
{{< req type="key" >}}
|
{{< req type="key" >}}
|
||||||
- {{< req "\*" >}} **bucketID:** [bucket ID](/influxdb/v2/admin/buckets/view-buckets/)
|
- {{< req "\*" >}} **bucketID:** [bucket ID](/influxdb/version/admin/buckets/view-buckets/)
|
||||||
- {{< req "\*" >}} **database:** database name
|
- {{< req "\*" >}} **database:** database name
|
||||||
- **default:** set the provided retention policy as the default retention policy for the database
|
- **default:** set the provided retention policy as the default retention policy for the database
|
||||||
- {{< req "\*" >}} **org** or **orgID:** organization name or [organization ID](/influxdb/v2/admin/organizations/view-orgs/#view-your-organization-id)
|
- {{< req "\*" >}} **org** or **orgID:** organization name or [organization ID](/influxdb/version/admin/organizations/view-orgs/#view-your-organization-id)
|
||||||
- {{< req "\*" >}} **retention_policy:** retention policy name
|
- {{< req "\*" >}} **retention_policy:** retention policy name
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
@ -120,7 +120,7 @@ curl --request POST http://localhost:8086/api/v2/dbrps \
|
||||||
|
|
||||||
## List DBRP mappings
|
## List DBRP mappings
|
||||||
|
|
||||||
Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) or the [InfluxDB API](/influxdb/v2/reference/api/)
|
Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) or the [InfluxDB API](/influxdb/version/reference/api/)
|
||||||
to list all DBRP mappings and verify the buckets you want to query are mapped
|
to list all DBRP mappings and verify the buckets you want to query are mapped
|
||||||
to a database and retention policy.
|
to a database and retention policy.
|
||||||
|
|
||||||
|
@ -131,11 +131,11 @@ to a database and retention policy.
|
||||||
{{% /tabs %}}
|
{{% /tabs %}}
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
|
|
||||||
Use the [`influx v1 dbrp list` command](/influxdb/v2/reference/cli/influx/v1/dbrp/list/) to list DBRP mappings.
|
Use the [`influx v1 dbrp list` command](/influxdb/version/reference/cli/influx/v1/dbrp/list/) to list DBRP mappings.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
The examples below assume that your organization and API token are
|
The examples below assume that your organization and API token are
|
||||||
provided by the active [InfluxDB connection configuration](/influxdb/v2/reference/cli/influx/config/) in the `influx` CLI.
|
provided by the active [InfluxDB connection configuration](/influxdb/version/reference/cli/influx/config/) in the `influx` CLI.
|
||||||
If not, include your organization (`--org`) and API token (`--token`) with each command.
|
If not, include your organization (`--org`) and API token (`--token`) with each command.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
|
@ -155,19 +155,19 @@ influx v1 dbrp list --bucket-id 00oxo0oXx000x0Xo
|
||||||
```
|
```
|
||||||
{{% /tab-content %}}
|
{{% /tab-content %}}
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
Use the [`/api/v2/dbrps` API endpoint](/influxdb/v2/api/#operation/GetDBRPs) to list DBRP mappings.
|
Use the [`/api/v2/dbrps` API endpoint](/influxdb/version/api/#operation/GetDBRPs) to list DBRP mappings.
|
||||||
|
|
||||||
{{< api-endpoint endpoint="http://localhost:8086/api/v2/dbrps" method="GET" api-ref="/influxdb/v2/api/#operation/GetDBRPs" >}}
|
{{< api-endpoint endpoint="http://localhost:8086/api/v2/dbrps" method="GET" api-ref="/influxdb/version/api/#operation/GetDBRPs" >}}
|
||||||
|
|
||||||
Include the following:
|
Include the following:
|
||||||
|
|
||||||
- **Request method:** `GET`
|
- **Request method:** `GET`
|
||||||
- **Headers:**
|
- **Headers:**
|
||||||
- **Authorization:** `Token` schema with your InfluxDB [API token](/influxdb/v2/admin/tokens/)
|
- **Authorization:** `Token` schema with your InfluxDB [API token](/influxdb/version/admin/tokens/)
|
||||||
- **Query parameters:**
|
- **Query parameters:**
|
||||||
{{< req type="key" >}}
|
{{< req type="key" >}}
|
||||||
- {{< req "\*" >}} **orgID:** [organization ID](/influxdb/v2/admin/organizations/view-orgs/#view-your-organization-id)
|
- {{< req "\*" >}} **orgID:** [organization ID](/influxdb/version/admin/organizations/view-orgs/#view-your-organization-id)
|
||||||
- **bucketID:** [bucket ID](/influxdb/v2/admin/buckets/view-buckets/) _(to list DBRP mappings for a specific bucket)_
|
- **bucketID:** [bucket ID](/influxdb/version/admin/buckets/view-buckets/) _(to list DBRP mappings for a specific bucket)_
|
||||||
- **database:** database name _(to list DBRP mappings with a specific database name)_
|
- **database:** database name _(to list DBRP mappings with a specific database name)_
|
||||||
- **rp:** retention policy name _(to list DBRP mappings with a specific retention policy name)_
|
- **rp:** retention policy name _(to list DBRP mappings with a specific retention policy name)_
|
||||||
- **id:** DBRP mapping ID _(to list a specific DBRP mapping)_
|
- **id:** DBRP mapping ID _(to list a specific DBRP mapping)_
|
||||||
|
@ -197,8 +197,8 @@ curl --request GET \
|
||||||
|
|
||||||
## Update a DBRP mapping
|
## Update a DBRP mapping
|
||||||
|
|
||||||
Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) or the
|
Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) or the
|
||||||
[InfluxDB API](/influxdb/v2/reference/api/) to update a DBRP mapping.
|
[InfluxDB API](/influxdb/version/reference/api/) to update a DBRP mapping.
|
||||||
|
|
||||||
{{% show-in "v2" %}}
|
{{% show-in "v2" %}}
|
||||||
|
|
||||||
|
@ -216,13 +216,13 @@ To override a virtual DBRP mapping, [create an explicit mapping](#create-dbrp-ma
|
||||||
{{% /tabs %}}
|
{{% /tabs %}}
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
|
|
||||||
Use the [`influx v1 dbrp update` command](/influxdb/v2/reference/cli/influx/v1/dbrp/update/)
|
Use the [`influx v1 dbrp update` command](/influxdb/version/reference/cli/influx/v1/dbrp/update/)
|
||||||
to update a DBRP mapping.
|
to update a DBRP mapping.
|
||||||
Include the following:
|
Include the following:
|
||||||
|
|
||||||
{{< req type="key" >}}
|
{{< req type="key" >}}
|
||||||
|
|
||||||
- {{< req "\*" >}} **org** and **token** to authenticate. We recommend setting your organization and token to your active InfluxDB connection configuration in the influx CLI, so you don't have to add these parameters to each command. To set up your active InfluxDB configuration, see [`influx config set`](/influxdb/v2/reference/cli/influx/config/set/).
|
- {{< req "\*" >}} **org** and **token** to authenticate. We recommend setting your organization and token to your active InfluxDB connection configuration in the influx CLI, so you don't have to add these parameters to each command. To set up your active InfluxDB configuration, see [`influx config set`](/influxdb/version/reference/cli/influx/config/set/).
|
||||||
- {{< req "\*" >}} **DBRP mapping ID** to update
|
- {{< req "\*" >}} **DBRP mapping ID** to update
|
||||||
- **Retention policy** name to update to
|
- **Retention policy** name to update to
|
||||||
- **Default flag** to set the retention policy as the default retention policy for the database
|
- **Default flag** to set the retention policy as the default retention policy for the database
|
||||||
|
@ -238,9 +238,9 @@ influx v1 dbrp update \
|
||||||
{{% /tab-content %}}
|
{{% /tab-content %}}
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
|
|
||||||
Use the [`/api/v2/dbrps/{dbrpID}` API endpoint](/influxdb/v2/api/#operation/GetDBRPs) to update DBRP mappings.
|
Use the [`/api/v2/dbrps/{dbrpID}` API endpoint](/influxdb/version/api/#operation/GetDBRPs) to update DBRP mappings.
|
||||||
|
|
||||||
{{< api-endpoint endpoint="http://localhost:8086/api/v2/dbrps/{dbrpID}" method="PATCH" api-ref="/influxdb/v2/api/#operation/PatchDBRPID" >}}
|
{{< api-endpoint endpoint="http://localhost:8086/api/v2/dbrps/{dbrpID}" method="PATCH" api-ref="/influxdb/version/api/#operation/PatchDBRPID" >}}
|
||||||
|
|
||||||
Include the following:
|
Include the following:
|
||||||
|
|
||||||
|
@ -248,11 +248,11 @@ Include the following:
|
||||||
|
|
||||||
- **Request method:** `PATCH`
|
- **Request method:** `PATCH`
|
||||||
- **Headers:**
|
- **Headers:**
|
||||||
- {{< req "\*" >}} **Authorization:** `Token` schema with your InfluxDB [API token](/influxdb/v2/admin/tokens/)
|
- {{< req "\*" >}} **Authorization:** `Token` schema with your InfluxDB [API token](/influxdb/version/admin/tokens/)
|
||||||
- **Path parameters:**
|
- **Path parameters:**
|
||||||
- {{< req "\*" >}} **id:** DBRP mapping ID to update
|
- {{< req "\*" >}} **id:** DBRP mapping ID to update
|
||||||
- **Query parameters:**
|
- **Query parameters:**
|
||||||
- {{< req "\*" >}} **orgID:** [organization ID](/influxdb/v2/admin/organizations/view-orgs/#view-your-organization-id)
|
- {{< req "\*" >}} **orgID:** [organization ID](/influxdb/version/admin/organizations/view-orgs/#view-your-organization-id)
|
||||||
- **Request body (JSON):**
|
- **Request body (JSON):**
|
||||||
- **rp:** retention policy name to update to
|
- **rp:** retention policy name to update to
|
||||||
- **default:** set the retention policy as the default retention policy for the database
|
- **default:** set the retention policy as the default retention policy for the database
|
||||||
|
@ -272,8 +272,8 @@ curl --request PATCH \
|
||||||
|
|
||||||
## Delete a DBRP mapping
|
## Delete a DBRP mapping
|
||||||
|
|
||||||
Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) or the
|
Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) or the
|
||||||
[InfluxDB API](/influxdb/v2/reference/api/) to delete a DBRP mapping.
|
[InfluxDB API](/influxdb/version/reference/api/) to delete a DBRP mapping.
|
||||||
|
|
||||||
{{% show-in "v2" %}}
|
{{% show-in "v2" %}}
|
||||||
|
|
||||||
|
@ -290,13 +290,13 @@ Virtual DBRP mappings cannot be deleted.
|
||||||
{{% /tabs %}}
|
{{% /tabs %}}
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
|
|
||||||
Use the [`influx v1 dbrp delete` command](/influxdb/v2/reference/cli/influx/v1/dbrp/delete/)
|
Use the [`influx v1 dbrp delete` command](/influxdb/version/reference/cli/influx/v1/dbrp/delete/)
|
||||||
to delete a DBRP mapping.
|
to delete a DBRP mapping.
|
||||||
Include the following:
|
Include the following:
|
||||||
|
|
||||||
{{< req type="key" >}}
|
{{< req type="key" >}}
|
||||||
|
|
||||||
- {{< req "\*" >}} **org** and **token** to authenticate. We recommend setting your organization and token to your active InfluxDB connection configuration in the influx CLI, so you don't have to add these parameters to each command. To set up your active InfluxDB configuration, see [`influx config set`](/influxdb/v2/reference/cli/influx/config/set/).
|
- {{< req "\*" >}} **org** and **token** to authenticate. We recommend setting your organization and token to your active InfluxDB connection configuration in the influx CLI, so you don't have to add these parameters to each command. To set up your active InfluxDB configuration, see [`influx config set`](/influxdb/version/reference/cli/influx/config/set/).
|
||||||
- {{< req "\*" >}} **DBRP mapping ID** to delete
|
- {{< req "\*" >}} **DBRP mapping ID** to delete
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -306,9 +306,9 @@ influx v1 dbrp delete --id 00oxo0X0xx0XXoX0
|
||||||
{{% /tab-content %}}
|
{{% /tab-content %}}
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
|
|
||||||
Use the [`/api/v2/dbrps/{dbrpID}` API endpoint](/influxdb/v2/api/#operation/DeleteDBRPID) to delete a DBRP mapping.
|
Use the [`/api/v2/dbrps/{dbrpID}` API endpoint](/influxdb/version/api/#operation/DeleteDBRPID) to delete a DBRP mapping.
|
||||||
|
|
||||||
{{< api-endpoint endpoint="http://localhost:8086/api/v2/dbrps/{dbrpID}" method="DELETE" api-ref="/influxdb/v2/api/#operation/DeleteDBRPID" >}}
|
{{< api-endpoint endpoint="http://localhost:8086/api/v2/dbrps/{dbrpID}" method="DELETE" api-ref="/influxdb/version/api/#operation/DeleteDBRPID" >}}
|
||||||
|
|
||||||
Include the following:
|
Include the following:
|
||||||
|
|
||||||
|
@ -316,11 +316,11 @@ Include the following:
|
||||||
|
|
||||||
- **Request method:** `PATCH`
|
- **Request method:** `PATCH`
|
||||||
- **Headers:**
|
- **Headers:**
|
||||||
- {{< req "\*" >}} **Authorization:** `Token` schema with your InfluxDB [API token](/influxdb/v2/admin/tokens/)
|
- {{< req "\*" >}} **Authorization:** `Token` schema with your InfluxDB [API token](/influxdb/version/admin/tokens/)
|
||||||
- **Path parameters:**
|
- **Path parameters:**
|
||||||
- {{< req "\*" >}} **id:** DBRP mapping ID to update
|
- {{< req "\*" >}} **id:** DBRP mapping ID to update
|
||||||
- **Query parameters:**
|
- **Query parameters:**
|
||||||
- {{< req "\*" >}} **orgID:** [organization ID](/influxdb/v2/admin/organizations/view-orgs/#view-your-organization-id)
|
- {{< req "\*" >}} **orgID:** [organization ID](/influxdb/version/admin/organizations/view-orgs/#view-your-organization-id)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl --request DELETE \
|
curl --request DELETE \
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
To start exploring data with InfluxQL, do the following:
|
To start exploring data with InfluxQL, do the following:
|
||||||
|
|
||||||
1. Verify your bucket has a database and retention policy (DBRP) mapping by [listing DBRP mappings for your bucket](/influxdb/v2/query-data/influxql/dbrp/#list-dbrp-mappings). If not, [create a new DBRP mapping](/influxdb/v2/query-data/influxql/dbrp/#create-dbrp-mappings).
|
1. Verify your bucket has a database and retention policy (DBRP) mapping by [listing DBRP mappings for your bucket](/influxdb/version/query-data/influxql/dbrp/#list-dbrp-mappings). If not, [create a new DBRP mapping](/influxdb/version/query-data/influxql/dbrp/#create-dbrp-mappings).
|
||||||
|
|
||||||
2. [Configure timestamps in the InfluxQL shell](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/).
|
2. [Configure timestamps in the InfluxQL shell](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/).
|
||||||
|
|
||||||
3. _(Optional)_ If you would like to use the data used in the examples below, [download the NOAA sample data](#download-sample-data).
|
3. _(Optional)_ If you would like to use the data used in the examples below, [download the NOAA sample data](#download-sample-data).
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ To start exploring data with InfluxQL, do the following:
|
||||||
|
|
||||||
The example InfluxQL queries in this documentation use publicly available [National Oceanic and Atmospheric Administration (NOAA)](https://www.noaa.gov/) data.
|
The example InfluxQL queries in this documentation use publicly available [National Oceanic and Atmospheric Administration (NOAA)](https://www.noaa.gov/) data.
|
||||||
|
|
||||||
To download a subset of NOAA data used in examples, run the script under [NOAA water sample data](/influxdb/v2/reference/sample-data/#noaa-water-sample-data) (for example, copy and paste the script into your Data Explorer - Script Editor), and replace "example-org" in the script with the name of your InfluxDB organization.
|
To download a subset of NOAA data used in examples, run the script under [NOAA water sample data](/influxdb/version/reference/sample-data/#noaa-water-sample-data) (for example, copy and paste the script into your Data Explorer - Script Editor), and replace "example-org" in the script with the name of your InfluxDB organization.
|
||||||
|
|
||||||
Let's get acquainted with this subsample of the data in the `h2o_feet` measurement:
|
Let's get acquainted with this subsample of the data in the `h2o_feet` measurement:
|
||||||
|
|
||||||
|
@ -35,28 +35,28 @@ Name: h2o_feet
|
||||||
| 2019-08-18T00:12:00Z | between 6 and 9 feet| coyote_creek | 7.8870000000 |
|
| 2019-08-18T00:12:00Z | between 6 and 9 feet| coyote_creek | 7.8870000000 |
|
||||||
| 2019-08-18T00:12:00Z | below 3 feet | santa_monica | 2.0280000000 |
|
| 2019-08-18T00:12:00Z | below 3 feet | santa_monica | 2.0280000000 |
|
||||||
|
|
||||||
The data in the `h2o_feet` [measurement](/influxdb/v2/reference/glossary/#measurement)
|
The data in the `h2o_feet` [measurement](/influxdb/version/reference/glossary/#measurement)
|
||||||
occurs at six-minute time intervals.
|
occurs at six-minute time intervals.
|
||||||
This measurement has one [tag key](/influxdb/v2/reference/glossary/#tag-key)
|
This measurement has one [tag key](/influxdb/version/reference/glossary/#tag-key)
|
||||||
(`location`) which has two [tag values](/influxdb/v2/reference/glossary/#tag-value):
|
(`location`) which has two [tag values](/influxdb/version/reference/glossary/#tag-value):
|
||||||
`coyote_creek` and `santa_monica`.
|
`coyote_creek` and `santa_monica`.
|
||||||
The measurement also has two [fields](/influxdb/v2/reference/glossary/#field):
|
The measurement also has two [fields](/influxdb/version/reference/glossary/#field):
|
||||||
`level description` stores string [field values](/influxdb/v2/reference/glossary/#field-value)
|
`level description` stores string [field values](/influxdb/version/reference/glossary/#field-value)
|
||||||
and `water_level` stores float field values.
|
and `water_level` stores float field values.
|
||||||
|
|
||||||
|
|
||||||
### Configure timestamps in the InfluxQL shell
|
### Configure timestamps in the InfluxQL shell
|
||||||
|
|
||||||
By default, the [InfluxQL shell](/influxdb/v2/tools/influxql-shell/) returns timestamps in
|
By default, the [InfluxQL shell](/influxdb/version/tools/influxql-shell/) returns timestamps in
|
||||||
nanosecond UNIX epoch format by default.
|
nanosecond UNIX epoch format by default.
|
||||||
To return human-readable RFC3339 timestamps instead of Unix nanosecond timestamps,
|
To return human-readable RFC3339 timestamps instead of Unix nanosecond timestamps,
|
||||||
use the [precision helper command](/influxdb/v2/tools/influxql-shell/#precision) ` to configure
|
use the [precision helper command](/influxdb/version/tools/influxql-shell/#precision) ` to configure
|
||||||
the timestamp format:
|
the timestamp format:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
precision rfc3339
|
precision rfc3339
|
||||||
```
|
```
|
||||||
|
|
||||||
The [InfluxDB API](/influxdb/v2/reference/api/influxdb-1x/) returns timestamps
|
The [InfluxDB API](/influxdb/version/reference/api/influxdb-1x/) returns timestamps
|
||||||
in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format by default.
|
in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format by default.
|
||||||
Specify alternative formats with the [`epoch` query string parameter](/influxdb/v2/reference/api/influxdb-1x/).
|
Specify alternative formats with the [`epoch` query string parameter](/influxdb/version/reference/api/influxdb-1x/).
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
Use the `GROUP BY` clause to group query results by one or more specified [tags](/influxdb/v2/reference/glossary/#tag) and/or a specified time interval. `GROUP BY` requires an [aggregate](/influxdb/v2/query-data/influxql/functions/aggregates/) or [selector](/influxdb/v2/query-data/influxql/functions/selectors/) function in the `SELECT` statement. `GROUP BY` supports [regular expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
Use the `GROUP BY` clause to group query results by one or more specified [tags](/influxdb/version/reference/glossary/#tag) and/or a specified time interval. `GROUP BY` requires an [aggregate](/influxdb/version/query-data/influxql/functions/aggregates/) or [selector](/influxdb/version/query-data/influxql/functions/selectors/) function in the `SELECT` statement. `GROUP BY` supports [regular expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** You cannot use `GROUP BY` to group **fields**.
|
**Note:** You cannot use `GROUP BY` to group **fields**.
|
||||||
|
@ -17,7 +17,7 @@ Use the `GROUP BY` clause to group query results by one or more specified [tags]
|
||||||
|
|
||||||
## GROUP BY tags
|
## GROUP BY tags
|
||||||
|
|
||||||
`GROUP BY <tag>` groups query results by one or more specified [tags](/influxdb/v2/reference/glossary/#tag).
|
`GROUP BY <tag>` groups query results by one or more specified [tags](/influxdb/version/reference/glossary/#tag).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -25,9 +25,9 @@ Use the `GROUP BY` clause to group query results by one or more specified [tags]
|
||||||
SELECT_clause FROM_clause [WHERE_clause] GROUP BY [* | <tag_key>[,<tag_key>]]
|
SELECT_clause FROM_clause [WHERE_clause] GROUP BY [* | <tag_key>[,<tag_key>]]
|
||||||
```
|
```
|
||||||
|
|
||||||
- `GROUP BY *` - Groups results by all [tags](/influxdb/v2/reference/glossary/#tag)
|
- `GROUP BY *` - Groups results by all [tags](/influxdb/version/reference/glossary/#tag)
|
||||||
- `GROUP BY <tag_key>` - Groups results by a specific tag
|
- `GROUP BY <tag_key>` - Groups results by a specific tag
|
||||||
- `GROUP BY <tag_key>,<tag_key>` - Groups results by more than one tag. The order of the [tag keys](/influxdb/v2/reference/glossary/#tag-key) is irrelevant.
|
- `GROUP BY <tag_key>,<tag_key>` - Groups results by more than one tag. The order of the [tag keys](/influxdb/version/reference/glossary/#tag-key) is irrelevant.
|
||||||
- `GROUP BY \regex\` - Groups results by tags that match the regular expression.
|
- `GROUP BY \regex\` - Groups results by tags that match the regular expression.
|
||||||
|
|
||||||
If the query includes a `WHERE` clause, the `GROUP BY` clause must appear after the `WHERE` clause.
|
If the query includes a `WHERE` clause, the `GROUP BY` clause must appear after the `WHERE` clause.
|
||||||
|
@ -61,15 +61,15 @@ tags: location=santa_monica
|
||||||
| :------------------- | -----------: |
|
| :------------------- | -----------: |
|
||||||
| 1970-01-01T00:00:00Z | 3.5307120942 |
|
| 1970-01-01T00:00:00Z | 3.5307120942 |
|
||||||
|
|
||||||
The query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/)
|
The query uses the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/)
|
||||||
to calculate the average `water_level` for each
|
to calculate the average `water_level` for each
|
||||||
[tag value](/influxdb/v2/reference/glossary/#tag-value) of `location` in
|
[tag value](/influxdb/version/reference/glossary/#tag-value) of `location` in
|
||||||
the `h2o_feet` [measurement](/influxdb/v2/reference/glossary/#measurement).
|
the `h2o_feet` [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
InfluxDB returns results in two [series](/influxdb/v2/reference/glossary/#series): one for each tag value of `location`.
|
InfluxDB returns results in two [series](/influxdb/version/reference/glossary/#series): one for each tag value of `location`.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** In InfluxDB, [epoch 0](https://en.wikipedia.org/wiki/Unix_time) (`1970-01-01T00:00:00Z`) is often used as a null timestamp equivalent.
|
**Note:** In InfluxDB, [epoch 0](https://en.wikipedia.org/wiki/Unix_time) (`1970-01-01T00:00:00Z`) is often used as a null timestamp equivalent.
|
||||||
If you request a query that has no timestamp to return, such as an [aggregation function](/influxdb/v2/query-data/influxql/functions/aggregates/) with an unbounded time range, InfluxDB returns epoch 0 as the timestamp.
|
If you request a query that has no timestamp to return, such as an [aggregation function](/influxdb/version/query-data/influxql/functions/aggregates/) with an unbounded time range, InfluxDB returns epoch 0 as the timestamp.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
@ -134,7 +134,7 @@ tags: location=santa_monica, randtag=3
|
||||||
| :------------------- | ------------: |
|
| :------------------- | ------------: |
|
||||||
| 1970-01-01T00:00:00Z | 49.9991990388 |
|
| 1970-01-01T00:00:00Z | 49.9991990388 |
|
||||||
|
|
||||||
The query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean) to calculate the average `index` for
|
The query uses the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean) to calculate the average `index` for
|
||||||
each combination of the `location` tag and the `randtag` tag in the
|
each combination of the `location` tag and the `randtag` tag in the
|
||||||
`h2o_quality` measurement.
|
`h2o_quality` measurement.
|
||||||
Separate multiple tags with a comma in the `GROUP BY` clause.
|
Separate multiple tags with a comma in the `GROUP BY` clause.
|
||||||
|
@ -201,8 +201,8 @@ tags: location=santa_monica, randtag=3
|
||||||
| :------------------- | ------------: |
|
| :------------------- | ------------: |
|
||||||
| 1970-01-01T00:00:00Z | 49.9991990388 |
|
| 1970-01-01T00:00:00Z | 49.9991990388 |
|
||||||
|
|
||||||
The query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean) to calculate the average `index` for every possible
|
The query uses the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean) to calculate the average `index` for every possible
|
||||||
[tag](/influxdb/v2/reference/glossary/#tag) combination in the `h2o_quality`
|
[tag](/influxdb/version/reference/glossary/#tag) combination in the `h2o_quality`
|
||||||
measurement.
|
measurement.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
@ -233,14 +233,14 @@ When using aggregate or selector functions in the `SELECT` clause, the operation
|
||||||
SELECT <function>(<field_key>) FROM_clause WHERE <time_range> GROUP BY time(<time_interval>),[tag_key] [fill(<fill_option>)]
|
SELECT <function>(<field_key>) FROM_clause WHERE <time_range> GROUP BY time(<time_interval>),[tag_key] [fill(<fill_option>)]
|
||||||
```
|
```
|
||||||
|
|
||||||
Basic `GROUP BY time()` queries require an InfluxQL [function](/influxdb/v2/query-data/influxql/functions)
|
Basic `GROUP BY time()` queries require an InfluxQL [function](/influxdb/version/query-data/influxql/functions)
|
||||||
in the `SELECT` clause and a time range in the `WHERE` clause.
|
in the `SELECT` clause and a time range in the `WHERE` clause.
|
||||||
Note that the `GROUP BY` clause must come **after** the `WHERE` clause.
|
Note that the `GROUP BY` clause must come **after** the `WHERE` clause.
|
||||||
|
|
||||||
##### `time(time_interval)`
|
##### `time(time_interval)`
|
||||||
|
|
||||||
The `time_interval` in the `GROUP BY time()` clause is a
|
The `time_interval` in the `GROUP BY time()` clause is a
|
||||||
[duration literal](/influxdb/v2/reference/glossary/#duration).
|
[duration literal](/influxdb/version/reference/glossary/#duration).
|
||||||
It determines how InfluxDB groups query results over time.
|
It determines how InfluxDB groups query results over time.
|
||||||
For example, a `time_interval` of `5m` groups query results into five-minute
|
For example, a `time_interval` of `5m` groups query results into five-minute
|
||||||
time groups across the time range specified in the `WHERE` clause.
|
time groups across the time range specified in the `WHERE` clause.
|
||||||
|
@ -303,7 +303,7 @@ Name: h2o_feet
|
||||||
| 2019-08-18T00:12:00Z | 2.0000000000 |
|
| 2019-08-18T00:12:00Z | 2.0000000000 |
|
||||||
| 2019-08-18T00:24:00Z | 2.0000000000 |
|
| 2019-08-18T00:24:00Z | 2.0000000000 |
|
||||||
|
|
||||||
The query uses the InfluxQL [COUNT() function](/influxdb/v2/query-data/influxql/functions/aggregates/#count) to count the number of `water_level` points per location, per 12-minute interval.
|
The query uses the InfluxQL [COUNT() function](/influxdb/version/query-data/influxql/functions/aggregates/#count) to count the number of `water_level` points per location, per 12-minute interval.
|
||||||
|
|
||||||
Each output row represents a single 12 minute interval.
|
Each output row represents a single 12 minute interval.
|
||||||
The count for the first timestamp covers the raw data between `2019-08-18T00:00:00Z`
|
The count for the first timestamp covers the raw data between `2019-08-18T00:00:00Z`
|
||||||
|
@ -342,13 +342,13 @@ tags: location=santa_monica
|
||||||
| 2019-08-18T00:12:00Z | 2.0000000000 |
|
| 2019-08-18T00:12:00Z | 2.0000000000 |
|
||||||
| 2019-08-18T00:24:00Z | 2.0000000000 |
|
| 2019-08-18T00:24:00Z | 2.0000000000 |
|
||||||
|
|
||||||
The query uses the InfluxQL [COUNT() function](/influxdb/v2/query-data/influxql/functions/aggregates/#count)
|
The query uses the InfluxQL [COUNT() function](/influxdb/version/query-data/influxql/functions/aggregates/#count)
|
||||||
to count the number of `water_level` points per location, per 12 minute interval.
|
to count the number of `water_level` points per location, per 12 minute interval.
|
||||||
Note that the time interval and the tag key are separated by a comma in the
|
Note that the time interval and the tag key are separated by a comma in the
|
||||||
`GROUP BY` clause.
|
`GROUP BY` clause.
|
||||||
|
|
||||||
The query returns two [series](/influxdb/v2/reference/glossary/#series) of results: one for each
|
The query returns two [series](/influxdb/version/reference/glossary/#series) of results: one for each
|
||||||
[tag value](/influxdb/v2/reference/glossary/#tag-value) of the `location` tag.
|
[tag value](/influxdb/version/reference/glossary/#tag-value) of the `location` tag.
|
||||||
The result for each timestamp represents a single 12 minute interval.
|
The result for each timestamp represents a single 12 minute interval.
|
||||||
Each output row represents a single 12 minute interval.
|
Each output row represents a single 12 minute interval.
|
||||||
and up to, but not including, `2019-08-18T00:12:00Z`.
|
and up to, but not including, `2019-08-18T00:12:00Z`.
|
||||||
|
@ -460,7 +460,7 @@ name: h2o_feet
|
||||||
SELECT <function>(<field_key>) FROM_clause WHERE <time_range> GROUP BY time(<time_interval>,<offset_interval>),[tag_key] [fill(<fill_option>)]
|
SELECT <function>(<field_key>) FROM_clause WHERE <time_range> GROUP BY time(<time_interval>,<offset_interval>),[tag_key] [fill(<fill_option>)]
|
||||||
```
|
```
|
||||||
|
|
||||||
Advanced `GROUP BY time()` queries require an InfluxQL [function](/influxdb/v2/query-data/influxql/functions/)
|
Advanced `GROUP BY time()` queries require an InfluxQL [function](/influxdb/version/query-data/influxql/functions/)
|
||||||
in the `SELECT` clause and a time range in the
|
in the `SELECT` clause and a time range in the
|
||||||
`WHERE` clause). Note that the `GROUP BY` clause must come after the `WHERE` clause.
|
`WHERE` clause). Note that the `GROUP BY` clause must come after the `WHERE` clause.
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ in the `SELECT` clause and a time range in the
|
||||||
See the [Basic GROUP BY time() Syntax](#basic-group-by-time-syntax)
|
See the [Basic GROUP BY time() Syntax](#basic-group-by-time-syntax)
|
||||||
for details on the `time_interval`.
|
for details on the `time_interval`.
|
||||||
|
|
||||||
The `offset_interval` is a [duration literal](/influxdb/v2/reference/glossary/#duration).
|
The `offset_interval` is a [duration literal](/influxdb/version/reference/glossary/#duration).
|
||||||
It shifts forward or back the InfluxDB database's preset time boundaries.
|
It shifts forward or back the InfluxDB database's preset time boundaries.
|
||||||
The `offset_interval` can be positive or negative.
|
The `offset_interval` can be positive or negative.
|
||||||
|
|
||||||
|
@ -529,7 +529,7 @@ Name: h2o_feet
|
||||||
| 2019-08-18T00:24:00Z | 8.0120000000 |
|
| 2019-08-18T00:24:00Z | 8.0120000000 |
|
||||||
| 2019-08-18T00:42:00Z | 7.6400000000 |
|
| 2019-08-18T00:42:00Z | 7.6400000000 |
|
||||||
|
|
||||||
The query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean)
|
The query uses the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean)
|
||||||
to calculate the average `water_level`, grouping results into 18 minute time intervals, and offsetting the preset time boundaries by 6 minutes.
|
to calculate the average `water_level`, grouping results into 18 minute time intervals, and offsetting the preset time boundaries by 6 minutes.
|
||||||
|
|
||||||
The time boundaries and returned timestamps for the query **without** the `offset_interval` adhere to the InfluxDB database's preset time boundaries. Let's first examine the results without the offset:
|
The time boundaries and returned timestamps for the query **without** the `offset_interval` adhere to the InfluxDB database's preset time boundaries. Let's first examine the results without the offset:
|
||||||
|
@ -610,7 +610,7 @@ Name: h2o_feet
|
||||||
| 2019-08-18T00:42:00Z | 7.6400000000 |
|
| 2019-08-18T00:42:00Z | 7.6400000000 |
|
||||||
|
|
||||||
|
|
||||||
The query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean) to calculate the average `water_level`, grouping results into 18 minute
|
The query uses the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean) to calculate the average `water_level`, grouping results into 18 minute
|
||||||
time intervals, and offsetting the preset time boundaries by -12 minutes.
|
time intervals, and offsetting the preset time boundaries by -12 minutes.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
|
@ -703,7 +703,7 @@ Name: h2o_feet
|
||||||
| :------------------- | -----------: |
|
| :------------------- | -----------: |
|
||||||
| 2019-08-18T00:06:00Z | 2.0000000000 |
|
| 2019-08-18T00:06:00Z | 2.0000000000 |
|
||||||
|
|
||||||
The query uses the InfluxQL [COUNT() function](/influxdb/v2/query-data/influxql/functions/aggregates/#count) to count the number of `water_level` points per location, per 12-minute interval, and offset the preset time boundaries by six minutes.
|
The query uses the InfluxQL [COUNT() function](/influxdb/version/query-data/influxql/functions/aggregates/#count) to count the number of `water_level` points per location, per 12-minute interval, and offset the preset time boundaries by six minutes.
|
||||||
|
|
||||||
The time boundaries and returned timestamps for the query **without** the `offset_interval` adhere to InfluxDB database's preset time boundaries. Let's first examine the results without the offset:
|
The time boundaries and returned timestamps for the query **without** the `offset_interval` adhere to InfluxDB database's preset time boundaries. Let's first examine the results without the offset:
|
||||||
|
|
||||||
|
@ -775,7 +775,7 @@ By default, a `GROUP BY time()` interval with no data reports `null` as its
|
||||||
value in the output column.
|
value in the output column.
|
||||||
`fill()` changes the value reported for time intervals with no data.
|
`fill()` changes the value reported for time intervals with no data.
|
||||||
Note that `fill()` must go at the end of the `GROUP BY` clause if you're
|
Note that `fill()` must go at the end of the `GROUP BY` clause if you're
|
||||||
`GROUP(ing) BY` several things (for example, both [tags](/influxdb/v2/reference/glossary/#tag) and a time interval).
|
`GROUP(ing) BY` several things (for example, both [tags](/influxdb/version/reference/glossary/#tag) and a time interval).
|
||||||
|
|
||||||
##### fill_option
|
##### fill_option
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
Use `LIMIT` and `SLIMIT` to limit the number of [points](/influxdb/v2/reference/glossary/#point) and [series](/influxdb/v2/reference/glossary/#series) returned per query.
|
Use `LIMIT` and `SLIMIT` to limit the number of [points](/influxdb/version/reference/glossary/#point) and [series](/influxdb/version/reference/glossary/#series) returned per query.
|
||||||
|
|
||||||
- [LIMIT clause](#limit-clause)
|
- [LIMIT clause](#limit-clause)
|
||||||
- [Syntax](#syntax)
|
- [Syntax](#syntax)
|
||||||
|
@ -11,7 +11,7 @@ Use `LIMIT` and `SLIMIT` to limit the number of [points](/influxdb/v2/reference/
|
||||||
|
|
||||||
## LIMIT clause
|
## LIMIT clause
|
||||||
|
|
||||||
`LIMIT <N>` returns the first `N` points from the specified [measurement](/influxdb/v2/reference/glossary/#measurement).
|
`LIMIT <N>` returns the first `N` points from the specified [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ Name: h2o_feet
|
||||||
| 2019-08-17T00:00:00Z | 2.0640000000 |santa_monica |
|
| 2019-08-17T00:00:00Z | 2.0640000000 |santa_monica |
|
||||||
| 2019-08-17T00:06:00Z | 8.0050000000 |coyote_creek |
|
| 2019-08-17T00:06:00Z | 8.0050000000 |coyote_creek |
|
||||||
|
|
||||||
The query returns the three oldest points, determined by timestamp, from the `h2o_feet` [measurement](/influxdb/v2/reference/glossary/#measurement).
|
The query returns the three oldest points, determined by timestamp, from the `h2o_feet` [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ tags: location=santa_monica
|
||||||
| 2019-08-18T00:00:00Z | 2.3655000000 |
|
| 2019-08-18T00:00:00Z | 2.3655000000 |
|
||||||
| 2019-08-18T00:12:00Z | 2.3360000000 |
|
| 2019-08-18T00:12:00Z | 2.3360000000 |
|
||||||
|
|
||||||
This query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean) and a `GROUP BY` clause to calculate the average `water_level` for each [tag](/influxdb/v2/reference/glossary/#tag) and for each 12-minute interval in the queried time range. `LIMIT 2` requests the two oldest 12-minute averages (determined by timestamp).
|
This query uses the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean) and a `GROUP BY` clause to calculate the average `water_level` for each [tag](/influxdb/version/reference/glossary/#tag) and for each 12-minute interval in the queried time range. `LIMIT 2` requests the two oldest 12-minute averages (determined by timestamp).
|
||||||
|
|
||||||
Note that without `LIMIT 2`, the query would return four points per series; one for each 12-minute interval in the queried time range.
|
Note that without `LIMIT 2`, the query would return four points per series; one for each 12-minute interval in the queried time range.
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ Note that without `LIMIT 2`, the query would return four points per series; one
|
||||||
|
|
||||||
## SLIMIT clause
|
## SLIMIT clause
|
||||||
|
|
||||||
`SLIMIT <N>` returns every [point](/influxdb/v2/reference/glossary/#point) from `N` [series](//influxdb/v2/reference/glossary/#series) in the specified [measurement](/influxdb/v2/reference/glossary/#measurement).
|
`SLIMIT <N>` returns every [point](/influxdb/version/reference/glossary/#point) from `N` [series](//influxdb/version/reference/glossary/#series) in the specified [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ tags: location=coyote_creek
|
||||||
| 2019-08-17T00:30:00Z | 7.5000000000|
|
| 2019-08-17T00:30:00Z | 7.5000000000|
|
||||||
| 2019-08-17T00:36:00Z | 7.3720000000|
|
| 2019-08-17T00:36:00Z | 7.3720000000|
|
||||||
|
|
||||||
The results above include only the first few rows, as the data set is quite large. The query returns all `water_level` [points](/influxdb/v2/reference/glossary/#point) from one of the [series](/influxdb/v2/reference/glossary/#series) associated with the `h2o_feet` [measurement](/influxdb/v2/reference/glossary/#measurement).
|
The results above include only the first few rows, as the data set is quite large. The query returns all `water_level` [points](/influxdb/version/reference/glossary/#point) from one of the [series](/influxdb/version/reference/glossary/#series) associated with the `h2o_feet` [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
|
||||||
|
@ -145,8 +145,8 @@ tags: location=coyote_creek
|
||||||
| 2019-08-18T00:24:00Z | 8.0710000000|
|
| 2019-08-18T00:24:00Z | 8.0710000000|
|
||||||
| 2019-08-18T00:36:00Z | 7.8330000000|
|
| 2019-08-18T00:36:00Z | 7.8330000000|
|
||||||
|
|
||||||
The query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean)
|
The query uses the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean)
|
||||||
and a time interval in the [GROUP BY clause](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
and a time interval in the [GROUP BY clause](/influxdb/version/query-data/influxql/explore-data/group-by/)
|
||||||
to calculate the average `water_level` for each 12-minute
|
to calculate the average `water_level` for each 12-minute
|
||||||
interval in the queried time range.
|
interval in the queried time range.
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ associated with the `h2o_feet` measurement: `location=coyote_creek` and
|
||||||
|
|
||||||
## Use LIMIT and SLIMIT together
|
## Use LIMIT and SLIMIT together
|
||||||
|
|
||||||
`LIMIT <N>` followed by `SLIMIT <2>` returns the first `N1` [points](/influxdb/v2/reference/glossary/#point) from `N2` series in the specified measurement.
|
`LIMIT <N>` followed by `SLIMIT <2>` returns the first `N1` [points](/influxdb/version/reference/glossary/#point) from `N2` series in the specified measurement.
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
Use `OFFSET` and `SOFFSET` to paginate [points](/influxdb/v2/reference/glossary/#point) and [series](/influxdb/v2/reference/glossary/#series) returned.
|
Use `OFFSET` and `SOFFSET` to paginate [points](/influxdb/version/reference/glossary/#point) and [series](/influxdb/version/reference/glossary/#series) returned.
|
||||||
|
|
||||||
- [OFFSET clause](#offset-clause)
|
- [OFFSET clause](#offset-clause)
|
||||||
- [Syntax](#syntax)
|
- [Syntax](#syntax)
|
||||||
|
@ -10,7 +10,7 @@ Use `OFFSET` and `SOFFSET` to paginate [points](/influxdb/v2/reference/glossary/
|
||||||
|
|
||||||
## `OFFSET` clause
|
## `OFFSET` clause
|
||||||
|
|
||||||
`OFFSET <N>` paginates `N` [points](/influxdb/v2/reference/glossary/#point) in the query results.
|
`OFFSET <N>` paginates `N` [points](/influxdb/version/reference/glossary/#point) in the query results.
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ Use `OFFSET` and `SOFFSET` to paginate [points](/influxdb/v2/reference/glossary/
|
||||||
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] LIMIT_clause OFFSET <N> [SLIMIT_clause]
|
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] LIMIT_clause OFFSET <N> [SLIMIT_clause]
|
||||||
```
|
```
|
||||||
|
|
||||||
`N` specifies the number of points to paginate. The `OFFSET` clause requires a [`LIMIT` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/#limit-clause).
|
`N` specifies the number of points to paginate. The `OFFSET` clause requires a [`LIMIT` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/#limit-clause).
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** InfluxDB returns no results if the `WHERE clause` includes a time range and the `OFFSET clause` would cause InfluxDB to return points with timestamps outside of that time range.
|
**Note:** InfluxDB returns no results if the `WHERE clause` includes a time range and the `OFFSET clause` would cause InfluxDB to return points with timestamps outside of that time range.
|
||||||
|
@ -44,7 +44,7 @@ Name: h2o_feet
|
||||||
| 2019-08-17T00:12:00Z | 7.8870000000 | coyote_creek|
|
| 2019-08-17T00:12:00Z | 7.8870000000 | coyote_creek|
|
||||||
| 2019-08-17T00:12:00Z | 2.0280000000 | santa_monica|
|
| 2019-08-17T00:12:00Z | 2.0280000000 | santa_monica|
|
||||||
|
|
||||||
The query returns the fourth, fifth, and sixth points from the `h2o_feet` [measurement](/influxdb/v2/reference/glossary/#measurement). If the query did not include `OFFSET 3`, it would return the first, second,
|
The query returns the fourth, fifth, and sixth points from the `h2o_feet` [measurement](/influxdb/version/reference/glossary/#measurement). If the query did not include `OFFSET 3`, it would return the first, second,
|
||||||
and third points from that measurement.
|
and third points from that measurement.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
@ -67,14 +67,14 @@ tags: location=coyote_creek
|
||||||
|
|
||||||
In this example:
|
In this example:
|
||||||
|
|
||||||
- The [`SELECT clause`](/influxdb/v2/query-data/influxql/explore-data/select/) specifies the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean).
|
- The [`SELECT clause`](/influxdb/version/query-data/influxql/explore-data/select/) specifies the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean).
|
||||||
- The [`FROM clause`] (/influxdb/v2/query-data/influxql/explore-data/select/#from-clause) specifies a single measurement.
|
- The [`FROM clause`] (/influxdb/version/query-data/influxql/explore-data/select/#from-clause) specifies a single measurement.
|
||||||
- The [`WHERE` clause](/influxdb/v2/query-data/influxql/explore-data/where/) specifies the time range for the query.
|
- The [`WHERE` clause](/influxdb/version/query-data/influxql/explore-data/where/) specifies the time range for the query.
|
||||||
- The [`GROUP BY` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/) groups results by all tags (`*`) and into 12-minute intervals.
|
- The [`GROUP BY` clause](/influxdb/version/query-data/influxql/explore-data/group-by/) groups results by all tags (`*`) and into 12-minute intervals.
|
||||||
- The [`ORDER BY time DESC` clause](/influxdb/v2/query-data/influxql/explore-data/order-by/#order-by-time-desc) returns results in descending timestamp order.
|
- The [`ORDER BY time DESC` clause](/influxdb/version/query-data/influxql/explore-data/order-by/#order-by-time-desc) returns results in descending timestamp order.
|
||||||
- The [`LIMIT 2` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/) limits the number of points returned to two.
|
- The [`LIMIT 2` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/) limits the number of points returned to two.
|
||||||
- The `OFFSET 2` clause excludes the first two averages from the query results.
|
- The `OFFSET 2` clause excludes the first two averages from the query results.
|
||||||
- The [`SLIMIT 1` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/) limits the number of series returned to one.
|
- The [`SLIMIT 1` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/) limits the number of series returned to one.
|
||||||
|
|
||||||
Without `OFFSET 2`, the query would return the first two averages of the query results:
|
Without `OFFSET 2`, the query would return the first two averages of the query results:
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ tags: location=coyote_creek
|
||||||
|
|
||||||
## `SOFFSET` clause
|
## `SOFFSET` clause
|
||||||
|
|
||||||
`SOFFSET <N>` paginates `N` [series](/influxdb/v2/reference/glossary/#series) in the query results.
|
`SOFFSET <N>` paginates `N` [series](/influxdb/version/reference/glossary/#series) in the query results.
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -103,8 +103,8 @@ tags: location=coyote_creek
|
||||||
SELECT_clause FROM_clause [WHERE_clause] GROUP BY *[,time(time_interval)] [ORDER_BY_clause] [LIMIT_clause] [OFFSET_clause] SLIMIT_clause SOFFSET <N>
|
SELECT_clause FROM_clause [WHERE_clause] GROUP BY *[,time(time_interval)] [ORDER_BY_clause] [LIMIT_clause] [OFFSET_clause] SLIMIT_clause SOFFSET <N>
|
||||||
```
|
```
|
||||||
|
|
||||||
`N` specifies the number of [series](/influxdb/v2/reference/glossary/#series) to paginate.
|
`N` specifies the number of [series](/influxdb/version/reference/glossary/#series) to paginate.
|
||||||
The `SOFFSET` clause requires an [`SLIMIT` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/.
|
The `SOFFSET` clause requires an [`SLIMIT` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/.
|
||||||
Using the `SOFFSET` clause without an `SLIMIT` clause can cause [inconsistent
|
Using the `SOFFSET` clause without an `SLIMIT` clause can cause [inconsistent
|
||||||
query results](https://github.com/influxdata/influxdb/issues/7578).
|
query results](https://github.com/influxdata/influxdb/issues/7578).
|
||||||
`SLIMIT` queries must include `GROUP BY *`.
|
`SLIMIT` queries must include `GROUP BY *`.
|
||||||
|
@ -165,15 +165,15 @@ tags: location=santa_monica
|
||||||
|
|
||||||
In this example:
|
In this example:
|
||||||
|
|
||||||
- The [`SELECT` clause](/influxdb/v2/query-data/influxql/explore-data/select/) specifies an InfluxQL [function](/influxdb/v2/query-data/influxql/functions/).
|
- The [`SELECT` clause](/influxdb/version/query-data/influxql/explore-data/select/) specifies an InfluxQL [function](/influxdb/version/query-data/influxql/functions/).
|
||||||
- The [`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause) specifies a single measurement.
|
- The [`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause) specifies a single measurement.
|
||||||
- The [`WHERE` clause](/influxdb/v2/query-data/influxql/explore-data/where/) specifies the time range for the query.
|
- The [`WHERE` clause](/influxdb/version/query-data/influxql/explore-data/where/) specifies the time range for the query.
|
||||||
- The [`GROUP BY` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/) groups results by all tags (`*`) and into 12-minute intervals.
|
- The [`GROUP BY` clause](/influxdb/version/query-data/influxql/explore-data/group-by/) groups results by all tags (`*`) and into 12-minute intervals.
|
||||||
- The [`ORDER BY time DESC` clause](/influxdb/v2/query-data/influxql/explore-data/order-by/#order-by-time-desc) returns results in descending timestamp order.
|
- The [`ORDER BY time DESC` clause](/influxdb/version/query-data/influxql/explore-data/order-by/#order-by-time-desc) returns results in descending timestamp order.
|
||||||
- The [`LIMIT 2` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/) limits the number of points returned to two.
|
- The [`LIMIT 2` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/) limits the number of points returned to two.
|
||||||
- The [`OFFSET 2` clause](/influxdb/v2/query-data/influxql/explore-data/offset-and-soffset/) excludes the first two averages from the query results.
|
- The [`OFFSET 2` clause](/influxdb/version/query-data/influxql/explore-data/offset-and-soffset/) excludes the first two averages from the query results.
|
||||||
- The [`SLIMIT 1` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/) limits the number of series returned to one.
|
- The [`SLIMIT 1` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/) limits the number of series returned to one.
|
||||||
- The [`SOFFSET 1`](/influxdb/v2/query-data/influxql/explore-data/offset-and-soffset/) clause paginates the series returned.
|
- The [`SOFFSET 1`](/influxdb/version/query-data/influxql/explore-data/offset-and-soffset/) clause paginates the series returned.
|
||||||
|
|
||||||
Without `SOFFSET 1`, the query would return the results for a different series:
|
Without `SOFFSET 1`, the query would return the results for a different series:
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ Use the `ORDER BY` clause to sort data.
|
||||||
|
|
||||||
## ORDER BY time DESC
|
## ORDER BY time DESC
|
||||||
|
|
||||||
By default, InfluxDB returns results in ascending time order; the first [point](/influxdb/v2/reference/glossary/#point)
|
By default, InfluxDB returns results in ascending time order; the first [point](/influxdb/version/reference/glossary/#point)
|
||||||
returned has the oldest [timestamp](/influxdb/v2/reference/glossary/#timestamp) and
|
returned has the oldest [timestamp](/influxdb/version/reference/glossary/#timestamp) and
|
||||||
the last point returned has the most recent timestamp.
|
the last point returned has the most recent timestamp.
|
||||||
`ORDER BY time DESC` reverses that order such that InfluxDB returns the points
|
`ORDER BY time DESC` reverses that order such that InfluxDB returns the points
|
||||||
with the most recent timestamps first.
|
with the most recent timestamps first.
|
||||||
|
@ -44,7 +44,7 @@ Name: h2o_feet
|
||||||
| 2019-09-17T21:18:00Z | 5.0720000000|
|
| 2019-09-17T21:18:00Z | 5.0720000000|
|
||||||
|
|
||||||
The query returns the points with the most recent timestamps from the
|
The query returns the points with the most recent timestamps from the
|
||||||
`h2o_feet` [measurement](/influxdb/v2/reference/glossary/#measurement) first.
|
`h2o_feet` [measurement](/influxdb/version/reference/glossary/#measurement) first.
|
||||||
Without `ORDER by time DESC`, the query would return the following output:
|
Without `ORDER by time DESC`, the query would return the following output:
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
|
@ -78,11 +78,11 @@ Name: h2o_feet
|
||||||
| 2019-08-18T00:12:00Z | 5.3042500000|
|
| 2019-08-18T00:12:00Z | 5.3042500000|
|
||||||
| 2019-08-18T00:00:00Z | 5.4135000000|
|
| 2019-08-18T00:00:00Z | 5.4135000000|
|
||||||
|
|
||||||
The query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean)
|
The query uses the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean)
|
||||||
and a time interval in the [GROUP BY clause](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
and a time interval in the [GROUP BY clause](/influxdb/version/query-data/influxql/explore-data/group-by/)
|
||||||
to calculate the average `water_level` for each 12-minute
|
to calculate the average `water_level` for each 12-minute
|
||||||
interval in the queried time range.
|
interval in the queried time range.
|
||||||
[`ORDER BY time DESC`](/influxdb/v2/query-data/influxql/explore-data/order-by/#order-by-time-desc) returns the most recent 12-minute time intervals
|
[`ORDER BY time DESC`](/influxdb/version/query-data/influxql/explore-data/order-by/#order-by-time-desc) returns the most recent 12-minute time intervals
|
||||||
first.
|
first.
|
||||||
|
|
||||||
Without `ORDER BY time DESC`, the query would return the following output:
|
Without `ORDER BY time DESC`, the query would return the following output:
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
|
|
||||||
InfluxQL supports using regular expressions when specifying:
|
InfluxQL supports using regular expressions when specifying:
|
||||||
|
|
||||||
- [field keys](/influxdb/v2/reference/glossary/#field-key) and [tag keys](/influxdb/v2/reference/glossary/#tag-key) in the [`SELECT` clause](/influxdb/v2/query-data/influxql/explore-data/select/).
|
- [field keys](/influxdb/version/reference/glossary/#field-key) and [tag keys](/influxdb/version/reference/glossary/#tag-key) in the [`SELECT` clause](/influxdb/version/query-data/influxql/explore-data/select/).
|
||||||
- [measurements](/influxdb/v2/reference/glossary/#measurement) in the [`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause).
|
- [measurements](/influxdb/version/reference/glossary/#measurement) in the [`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause).
|
||||||
- [tag values](/influxdb/v2/reference/glossary/#tag-value) and string [field values](/influxdb/v2/reference/glossary/#field-value) in the [`WHERE` clause](/influxdb/v2/query-data/influxql/explore-data/where/).
|
- [tag values](/influxdb/version/reference/glossary/#tag-value) and string [field values](/influxdb/version/reference/glossary/#field-value) in the [`WHERE` clause](/influxdb/version/query-data/influxql/explore-data/where/).
|
||||||
- [tag keys](/influxdb/v2/reference/glossary/#tag-key) in the [`GROUP BY` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
- [tag keys](/influxdb/version/reference/glossary/#tag-key) in the [`GROUP BY` clause](/influxdb/version/query-data/influxql/explore-data/group-by/)
|
||||||
|
|
||||||
Regular expressions in InfluxQL only support string comparisons and can only evaluate [fields](/influxdb/v2/reference/glossary/#field) with string values.
|
Regular expressions in InfluxQL only support string comparisons and can only evaluate [fields](/influxdb/version/reference/glossary/#field) with string values.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** Regular expression comparisons are more computationally intensive than exact
|
**Note:** Regular expression comparisons are more computationally intensive than exact
|
||||||
|
@ -119,7 +119,7 @@ Name: h2o_feet
|
||||||
| :------------------- | ---------------------:|
|
| :------------------- | ---------------------:|
|
||||||
| 2019-08-28T07:24:00Z | 9.964
|
| 2019-08-28T07:24:00Z | 9.964
|
||||||
|
|
||||||
This query uses the InfluxQL [`MAX()` selector function](/influxdb/v2/query-data/influxql/functions/selectors/#max)
|
This query uses the InfluxQL [`MAX()` selector function](/influxdb/version/query-data/influxql/functions/selectors/#max)
|
||||||
to find the greatest field value out of all field keys that match the regular expression.
|
to find the greatest field value out of all field keys that match the regular expression.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
@ -148,7 +148,7 @@ Name: h2o_feet
|
||||||
| :------------------ | ---------------------:|
|
| :------------------ | ---------------------:|
|
||||||
| 1970-01-01T00:00:00Z | 64.9980273540 |
|
| 1970-01-01T00:00:00Z | 64.9980273540 |
|
||||||
|
|
||||||
This query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean) to calculate the average `degrees` for every [measurement](/influxdb/v2/reference/glossary/#measurement) in the [NOAA sample data] that contains the word `temperature`.
|
This query uses the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean) to calculate the average `degrees` for every [measurement](/influxdb/version/reference/glossary/#measurement) in the [NOAA sample data] that contains the word `temperature`.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ Name: h2o_feet
|
||||||
| :------------------ | ---------------------:|
|
| :------------------ | ---------------------:|
|
||||||
| 1970-01-01T00:00:00Z | 4.4710766395|
|
| 1970-01-01T00:00:00Z | 4.4710766395|
|
||||||
|
|
||||||
This query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean) to calculate the average `water_level` where the [tag value](/influxdb/v2/reference/glossary/#measurement) of `location` includes an `m` and `water_level` is greater than three.
|
This query uses the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean) to calculate the average `water_level` where the [tag value](/influxdb/version/reference/glossary/#measurement) of `location` includes an `m` and `water_level` is greater than three.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
|
||||||
|
@ -179,10 +179,10 @@ SELECT * FROM "h2o_feet" WHERE "location" !~ /./
|
||||||
```
|
```
|
||||||
|
|
||||||
The query selects all data from the `h2o_feet` measurement where the `location`
|
The query selects all data from the `h2o_feet` measurement where the `location`
|
||||||
[tag](/influxdb/v2/reference/glossary/#tag) has no value.
|
[tag](/influxdb/version/reference/glossary/#tag) has no value.
|
||||||
Every data [point](/influxdb/v2/reference/glossary/#point) in the [NOAA water sample data](/influxdb/v2/reference/sample-data/#noaa-water-sample-data) has a tag value for `location`.
|
Every data [point](/influxdb/version/reference/glossary/#point) in the [NOAA water sample data](/influxdb/version/reference/sample-data/#noaa-water-sample-data) has a tag value for `location`.
|
||||||
It's possible to perform this same query without a regular expression.
|
It's possible to perform this same query without a regular expression.
|
||||||
See the [Frequently Asked Questions](/influxdb/v2/reference/faq/#how-do-i-query-data-by-a-tag-with-a-null-value)
|
See the [Frequently Asked Questions](/influxdb/version/reference/faq/#how-do-i-query-data-by-a-tag-with-a-null-value)
|
||||||
document for more information.
|
document for more information.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
@ -202,7 +202,7 @@ Name: h2o_feet
|
||||||
| :------------------ | ---------------------:|
|
| :------------------ | ---------------------:|
|
||||||
| 1970-01-01T00:00:00Z | 4.4418434585|
|
| 1970-01-01T00:00:00Z | 4.4418434585|
|
||||||
|
|
||||||
This query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean) to calculate the average `water_level` across all data with a tag value for `location`.
|
This query uses the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean) to calculate the average `water_level` across all data with a tag value for `location`.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ Name: h2o_feet
|
||||||
| 1970-01-01T00:00:00Z | 4.4713666916
|
| 1970-01-01T00:00:00Z | 4.4713666916
|
||||||
|
|
||||||
|
|
||||||
This query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean)
|
This query uses the InfluxQL [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean)
|
||||||
to calculate the average `water_level` for all data where the field value of `level description` includes the word `between`.
|
to calculate the average `water_level` for all data where the field value of `level description` includes the word `between`.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
@ -253,7 +253,7 @@ tags: location=santa_monica
|
||||||
| :------------------ |-------------------:|
|
| :------------------ |-------------------:|
|
||||||
| 2019-08-17T00:00:00Z | 99.0000000000 |
|
| 2019-08-17T00:00:00Z | 99.0000000000 |
|
||||||
|
|
||||||
This query uses the InfluxQL [FIRST() function](/influxdb/v2/query-data/influxql/functions/selectors/#first)
|
This query uses the InfluxQL [FIRST() function](/influxdb/version/query-data/influxql/functions/selectors/#first)
|
||||||
|
|
||||||
to select the first value of `index` for every tag that includes the letter `l`
|
to select the first value of `index` for every tag that includes the letter `l`
|
||||||
in its tag key.
|
in its tag key.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
Use the `SELECT` statement to query data from a particular [measurement](/influxdb/v2/reference/glossary/#measurement) or measurements.
|
Use the `SELECT` statement to query data from a particular [measurement](/influxdb/version/reference/glossary/#measurement) or measurements.
|
||||||
|
|
||||||
- [Syntax](#syntax)
|
- [Syntax](#syntax)
|
||||||
- [Examples](#examples)
|
- [Examples](#examples)
|
||||||
|
@ -22,19 +22,19 @@ SELECT <field_key>[,<field_key>,<tag_key>] FROM <measurement_name>[,<measurement
|
||||||
|
|
||||||
The `SELECT` clause supports several formats for specifying data:
|
The `SELECT` clause supports several formats for specifying data:
|
||||||
|
|
||||||
- `SELECT *` - Returns all [fields](/influxdb/v2/reference/glossary/#field) and [tags](/influxdb/v2/reference/glossary/#tag).
|
- `SELECT *` - Returns all [fields](/influxdb/version/reference/glossary/#field) and [tags](/influxdb/version/reference/glossary/#tag).
|
||||||
- `SELECT "<field_key>"` - Returns a specific field.
|
- `SELECT "<field_key>"` - Returns a specific field.
|
||||||
- `SELECT "<field_key>","<field_key>"` - Returns more than one field.
|
- `SELECT "<field_key>","<field_key>"` - Returns more than one field.
|
||||||
- `SELECT "<field_key>","<tag_key>"` - Returns a specific field and tag. The `SELECT` clause must specify at least one field when it includes a tag.
|
- `SELECT "<field_key>","<tag_key>"` - Returns a specific field and tag. The `SELECT` clause must specify at least one field when it includes a tag.
|
||||||
- `SELECT "<field_key>"::field,"<tag_key>"::tag` - Returns a specific field and tag.
|
- `SELECT "<field_key>"::field,"<tag_key>"::tag` - Returns a specific field and tag.
|
||||||
The `::[field | tag]` syntax specifies the [identifier's](/influxdb/v2/reference/syntax/influxql/spec/#identifiers) type.
|
The `::[field | tag]` syntax specifies the [identifier's](/influxdb/version/reference/syntax/influxql/spec/#identifiers) type.
|
||||||
Use this syntax to differentiate between field keys and tag keys with the same name.
|
Use this syntax to differentiate between field keys and tag keys with the same name.
|
||||||
|
|
||||||
Other supported features include:
|
Other supported features include:
|
||||||
|
|
||||||
- [Functions](/influxdb/v2/query-data/influxql/functions/)
|
- [Functions](/influxdb/version/query-data/influxql/functions/)
|
||||||
- [Basic cast operations](#data-types-and-cast-operations)
|
- [Basic cast operations](#data-types-and-cast-operations)
|
||||||
- [Regular expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)
|
- [Regular expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/)
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** The SELECT statement cannot include an aggregate function **and** a non-aggregate function, field key, or tag key. For more information, see [error about mixing aggregate and non-aggregate queries](/enterprise_influxdb/v1/troubleshooting/errors/#error-parsing-query-mixing-aggregate-and-non-aggregate-queries-is-not-supported).
|
**Note:** The SELECT statement cannot include an aggregate function **and** a non-aggregate function, field key, or tag key. For more information, see [error about mixing aggregate and non-aggregate queries](/enterprise_influxdb/v1/troubleshooting/errors/#error-parsing-query-mixing-aggregate-and-non-aggregate-queries-is-not-supported).
|
||||||
|
@ -43,7 +43,7 @@ Other supported features include:
|
||||||
### `FROM` clause
|
### `FROM` clause
|
||||||
|
|
||||||
The `SELECT` clause specifies the measurement to query.
|
The `SELECT` clause specifies the measurement to query.
|
||||||
This clause supports several formats for specifying a [measurement](/influxdb/v2/reference/glossary/#measurement):
|
This clause supports several formats for specifying a [measurement](/influxdb/version/reference/glossary/#measurement):
|
||||||
|
|
||||||
- `FROM <measurement_name>` - Returns data from a measurement.
|
- `FROM <measurement_name>` - Returns data from a measurement.
|
||||||
- `FROM <measurement_name>,<measurement_name>` - Returns data from more than one measurement.
|
- `FROM <measurement_name>,<measurement_name>` - Returns data from more than one measurement.
|
||||||
|
@ -52,13 +52,13 @@ This clause supports several formats for specifying a [measurement](/influxdb/v2
|
||||||
|
|
||||||
#### Quoting
|
#### Quoting
|
||||||
|
|
||||||
[Identifiers](/influxdb/v2/reference/syntax/influxql/spec/#identifiers) **must** be double quoted if they contain characters other than `[A-z,0-9,_]`,
|
[Identifiers](/influxdb/version/reference/syntax/influxql/spec/#identifiers) **must** be double quoted if they contain characters other than `[A-z,0-9,_]`,
|
||||||
begin with a digit, or are an [InfluxQL keyword](https://github.com/influxdata/influxql/blob/master/README.md#keywords).
|
begin with a digit, or are an [InfluxQL keyword](https://github.com/influxdata/influxql/blob/master/README.md#keywords).
|
||||||
While not always necessary, we recommend that you double quote identifiers.
|
While not always necessary, we recommend that you double quote identifiers.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** InfluxQL quoting guidelines differ from [line protocol quoting guidelines](/influxdb/v2/reference/syntax/line-protocol/#quotes).
|
**Note:** InfluxQL quoting guidelines differ from [line protocol quoting guidelines](/influxdb/version/reference/syntax/line-protocol/#quotes).
|
||||||
Please review the [rules for single and double-quoting](/influxdb/v2/reference/syntax/line-protocol/#quotes) in queries.
|
Please review the [rules for single and double-quoting](/influxdb/version/reference/syntax/line-protocol/#quotes) in queries.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -84,9 +84,9 @@ Name: h2o_feet
|
||||||
| 2019-08-17T00:12:00Z | between 6 and 9 feet | coyote_creek | 7.8870000000|
|
| 2019-08-17T00:12:00Z | between 6 and 9 feet | coyote_creek | 7.8870000000|
|
||||||
| 2019-08-17T00:18:00Z | below 3 feet |santa_monica | 2.1260000000|
|
| 2019-08-17T00:18:00Z | below 3 feet |santa_monica | 2.1260000000|
|
||||||
|
|
||||||
The data above is a partial listing of the query output, as the result set is quite large. The query selects all [fields](/influxdb/v2/reference/glossary/#field) and
|
The data above is a partial listing of the query output, as the result set is quite large. The query selects all [fields](/influxdb/version/reference/glossary/#field) and
|
||||||
[tags](/influxdb/v2/reference/glossary/#tag) from the `h2o_feet`
|
[tags](/influxdb/version/reference/glossary/#tag) from the `h2o_feet`
|
||||||
[measurement](/influxdb/v2/reference/glossary/#measurement).
|
[measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ Name: h2o_feet
|
||||||
The query selects the `level description` field, the `location` tag, and the
|
The query selects the `level description` field, the `location` tag, and the
|
||||||
`water_level` field from the `h2o_feet` measurement.
|
`water_level` field from the `h2o_feet` measurement.
|
||||||
The `::[field | tag]` syntax specifies if the
|
The `::[field | tag]` syntax specifies if the
|
||||||
[identifier](/influxdb/v2/reference/syntax/influxql/spec/#identifiers) is a field or tag.
|
[identifier](/influxdb/version/reference/syntax/influxql/spec/#identifiers) is a field or tag.
|
||||||
Use `::[field | tag]` to differentiate between [an identical field key and tag key ](/v2.4/reference/faq/#how-do-i-query-data-with-an-identical-tag-key-and-field-key).
|
Use `::[field | tag]` to differentiate between [an identical field key and tag key ](/v2.4/reference/faq/#how-do-i-query-data-with-an-identical-tag-key-and-field-key).
|
||||||
That syntax is not required for most use cases.
|
That syntax is not required for most use cases.
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ values.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** InfluxDB follows the standard order of operations.
|
**Note:** InfluxDB follows the standard order of operations.
|
||||||
See [InfluxQL mathematical operators](/influxdb/v2/query-data/influxql/math-operators/)
|
See [InfluxQL mathematical operators](/influxdb/version/query-data/influxql/math-operators/)
|
||||||
for more on supported operators.
|
for more on supported operators.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
|
@ -266,9 +266,9 @@ The `..` indicates the `DEFAULT` retention policy for the specified database.
|
||||||
|
|
||||||
### Selecting tag keys in the SELECT statement
|
### Selecting tag keys in the SELECT statement
|
||||||
|
|
||||||
A query requires at least one [field key](/influxdb/v2/reference/glossary/#field-key)
|
A query requires at least one [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
in the `SELECT` clause to return data.
|
in the `SELECT` clause to return data.
|
||||||
If the `SELECT` clause only includes a single [tag key](/influxdb/v2/reference/glossary/#tag-key) or several tag keys, the
|
If the `SELECT` clause only includes a single [tag key](/influxdb/version/reference/glossary/#tag-key) or several tag keys, the
|
||||||
query returns an empty response.
|
query returns an empty response.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
@ -304,11 +304,11 @@ Name: h2o_feet
|
||||||
|
|
||||||
## Regular expressions
|
## Regular expressions
|
||||||
|
|
||||||
InfluxQL supports using [regular expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/) when specifying:
|
InfluxQL supports using [regular expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/) when specifying:
|
||||||
- [field keys](/influxdb/v2/reference/glossary/#field-key) and [tag keys](/influxdb/v2/reference/glossary/#tag-key) in the [`SELECT` clause](/influxdb/v2/query-data/influxql/explore-data/select/)
|
- [field keys](/influxdb/version/reference/glossary/#field-key) and [tag keys](/influxdb/version/reference/glossary/#tag-key) in the [`SELECT` clause](/influxdb/version/query-data/influxql/explore-data/select/)
|
||||||
- [measurements](/influxdb/v2/reference/glossary/#measurement) in the [`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause)
|
- [measurements](/influxdb/version/reference/glossary/#measurement) in the [`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause)
|
||||||
- [tag values](/influxdb/v2/reference/glossary/#tag-value) and string [field values](/influxdb/v2/reference/glossary/#field-value) in the [`WHERE` clause](/influxdb/v2/query-data/influxql/explore-data/where/).
|
- [tag values](/influxdb/version/reference/glossary/#tag-value) and string [field values](/influxdb/version/reference/glossary/#field-value) in the [`WHERE` clause](/influxdb/version/query-data/influxql/explore-data/where/).
|
||||||
- [tag keys](/influxdb/v2/reference/glossary/#tag-key) in the [`GROUP BY` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
- [tag keys](/influxdb/version/reference/glossary/#tag-key) in the [`GROUP BY` clause](/influxdb/version/query-data/influxql/explore-data/group-by/)
|
||||||
|
|
||||||
## Syntax
|
## Syntax
|
||||||
|
|
||||||
|
@ -316,29 +316,29 @@ InfluxQL supports using [regular expressions](/influxdb/v2/query-data/influxql/e
|
||||||
SELECT /<regular_expression_field_key>/ FROM /<regular_expression_measurement>/ WHERE [<tag_key> <operator> /<regular_expression_tag_value>/ | <field_key> <operator> /<regular_expression_field_value>/] GROUP BY /<regular_expression_tag_key>/
|
SELECT /<regular_expression_field_key>/ FROM /<regular_expression_measurement>/ WHERE [<tag_key> <operator> /<regular_expression_tag_value>/ | <field_key> <operator> /<regular_expression_field_value>/] GROUP BY /<regular_expression_tag_key>/
|
||||||
```
|
```
|
||||||
|
|
||||||
See [regular expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/) for more information.
|
See [regular expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/) for more information.
|
||||||
|
|
||||||
## Data types and cast operations
|
## Data types and cast operations
|
||||||
|
|
||||||
The [`SELECT` clause](#select-clause) supports specifying a [field's](/influxdb/v2/reference/glossary/#field) type and basic cast operations with the `::` syntax.
|
The [`SELECT` clause](#select-clause) supports specifying a [field's](/influxdb/version/reference/glossary/#field) type and basic cast operations with the `::` syntax.
|
||||||
|
|
||||||
- [Data types](#data-types)
|
- [Data types](#data-types)
|
||||||
- [Cast operations](#cast-operations)
|
- [Cast operations](#cast-operations)
|
||||||
|
|
||||||
### Data types
|
### Data types
|
||||||
|
|
||||||
[Field values](/influxdb/v2/reference/glossary/#field-value) can be floats, integers, strings, or booleans.
|
[Field values](/influxdb/version/reference/glossary/#field-value) can be floats, integers, strings, or booleans.
|
||||||
The `::` syntax allows users to specify the field's type in a query.
|
The `::` syntax allows users to specify the field's type in a query.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** Generally, it is not necessary to specify the field value type in the [`SELECT` clause](/influxdb/v2/query-data/influxql/explore-data/select/). In most cases, InfluxDB rejects any writes that attempt to write a [field value](/influxdb/v2/reference/glossary/#field-value) to a field that previously accepted field values of a different type.
|
**Note:** Generally, it is not necessary to specify the field value type in the [`SELECT` clause](/influxdb/version/query-data/influxql/explore-data/select/). In most cases, InfluxDB rejects any writes that attempt to write a [field value](/influxdb/version/reference/glossary/#field-value) to a field that previously accepted field values of a different type.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
It is possible for field value types to differ across [shard groups](/influxdb/v2/reference/glossary/#shard-group).
|
It is possible for field value types to differ across [shard groups](/influxdb/version/reference/glossary/#shard-group).
|
||||||
In these cases, it may be necessary to specify the field value type in the
|
In these cases, it may be necessary to specify the field value type in the
|
||||||
`SELECT` clause.
|
`SELECT` clause.
|
||||||
Please see the
|
Please see the
|
||||||
[Frequently Asked Questions](/influxdb/v2/reference/faq/#how-does-influxdb-handle-field-type-discrepancies-across-shards)
|
[Frequently Asked Questions](/influxdb/version/reference/faq/#how-does-influxdb-handle-field-type-discrepancies-across-shards)
|
||||||
document for more information on how InfluxDB handles field value type discrepancies.
|
document for more information on how InfluxDB handles field value type discrepancies.
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
@ -373,7 +373,7 @@ The query returns values of the `water_level` field key that are floats.
|
||||||
## Cast operations
|
## Cast operations
|
||||||
|
|
||||||
The `::` syntax allows users to perform basic cast operations in queries.
|
The `::` syntax allows users to perform basic cast operations in queries.
|
||||||
Currently, InfluxDB supports casting [field values](/influxdb/v2/reference/glossary/#field-value) from integers to
|
Currently, InfluxDB supports casting [field values](/influxdb/version/reference/glossary/#field-value) from integers to
|
||||||
floats or from floats to integers.
|
floats or from floats to integers.
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
@ -407,7 +407,7 @@ Name: h2o_feet
|
||||||
| 2019-08-17T00:06:00Z | 8.0000000000 |
|
| 2019-08-17T00:06:00Z | 8.0000000000 |
|
||||||
| 2019-08-17T00:06:00Z | 2.0000000000 |
|
| 2019-08-17T00:06:00Z | 2.0000000000 |
|
||||||
|
|
||||||
The query returns the integer form of `water_level`'s float [field values](/influxdb/v2/reference/glossary/#field-value).
|
The query returns the integer form of `water_level`'s float [field values](/influxdb/version/reference/glossary/#field-value).
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ The query returns no data as casting a float field value to a string is not yet
|
||||||
|
|
||||||
## Merge behavior
|
## Merge behavior
|
||||||
|
|
||||||
InfluxQL merges [series](/influxdb/v2/reference/glossary/#series) automatically.
|
InfluxQL merges [series](/influxdb/version/reference/glossary/#series) automatically.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
|
@ -434,10 +434,10 @@ InfluxQL merges [series](/influxdb/v2/reference/glossary/#series) automatically.
|
||||||
|
|
||||||
{{% expand "Merge behavior" %}}
|
{{% expand "Merge behavior" %}}
|
||||||
|
|
||||||
The `h2o_feet` [measurement](/influxdb/v2/reference/glossary/#measurement) in the `noaa` is part of two [series](/influxdb/v2/reference/glossary/#series).
|
The `h2o_feet` [measurement](/influxdb/version/reference/glossary/#measurement) in the `noaa` is part of two [series](/influxdb/version/reference/glossary/#series).
|
||||||
The first series is made up of the `h2o_feet` measurement and the `location = coyote_creek` [tag](/influxdb/v2/reference/glossary/#tag). The second series is made of up the `h2o_feet` measurement and the `location = santa_monica` tag.
|
The first series is made up of the `h2o_feet` measurement and the `location = coyote_creek` [tag](/influxdb/version/reference/glossary/#tag). The second series is made of up the `h2o_feet` measurement and the `location = santa_monica` tag.
|
||||||
|
|
||||||
The following query automatically merges those two series when it calculates the average `water_level` using the [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean):
|
The following query automatically merges those two series when it calculates the average `water_level` using the [MEAN() function](/influxdb/version/query-data/influxql/functions/aggregates/#mean):
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT MEAN("water_level") FROM "h2o_feet"
|
SELECT MEAN("water_level") FROM "h2o_feet"
|
||||||
|
@ -451,7 +451,7 @@ Name: h2o_feet
|
||||||
| :------------------ |-------------------:|
|
| :------------------ |-------------------:|
|
||||||
| 1970-01-01T00:00:00Z | 4.4419314021 |
|
| 1970-01-01T00:00:00Z | 4.4419314021 |
|
||||||
|
|
||||||
If you want the average `water_level` for the first series only, specify the relevant tag in the [`WHERE` clause](/influxdb/v2/query-data/influxql/explore-data/where/):
|
If you want the average `water_level` for the first series only, specify the relevant tag in the [`WHERE` clause](/influxdb/version/query-data/influxql/explore-data/where/):
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location" = 'coyote_creek'
|
SELECT MEAN("water_level") FROM "h2o_feet" WHERE "location" = 'coyote_creek'
|
||||||
|
@ -465,7 +465,7 @@ Name: h2o_feet
|
||||||
| :------------------ |-------------------:|
|
| :------------------ |-------------------:|
|
||||||
| 1970-01-01T00:00:00Z | 5.3591424203 |
|
| 1970-01-01T00:00:00Z | 5.3591424203 |
|
||||||
|
|
||||||
If you want the average `water_level` for each individual series, include a [`GROUP BY` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/):
|
If you want the average `water_level` for each individual series, include a [`GROUP BY` clause](/influxdb/version/query-data/influxql/explore-data/group-by/):
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT MEAN("water_level") FROM "h2o_feet" GROUP BY "location"
|
SELECT MEAN("water_level") FROM "h2o_feet" GROUP BY "location"
|
||||||
|
@ -507,7 +507,7 @@ Separate multiple `SELECT` statements in a query with a semicolon (`;`).
|
||||||
|
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
|
|
||||||
In the [InfluxQL shell](/influxdb/v2/tools/influxql-shell/):
|
In the [InfluxQL shell](/influxdb/version/tools/influxql-shell/):
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT MEAN("water_level") FROM "h2o_feet"; SELECT "water_level" FROM "h2o_feet" LIMIT 2
|
SELECT MEAN("water_level") FROM "h2o_feet"; SELECT "water_level" FROM "h2o_feet" LIMIT 2
|
||||||
|
@ -535,7 +535,7 @@ Name: h2o_feet
|
||||||
|
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
|
|
||||||
With the [InfluxDB API](/influxdb/v2/reference/api/influxdb-1x/):
|
With the [InfluxDB API](/influxdb/version/reference/api/influxdb-1x/):
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@ SELECT_clause FROM ( SELECT_statement ) [...]
|
||||||
|
|
||||||
InfluxDB **performs the subquery first** and the main query second.
|
InfluxDB **performs the subquery first** and the main query second.
|
||||||
|
|
||||||
The main query surrounds the subquery and requires at least the [`SELECT` clause](/influxdb/v2/query-data/influxql/explore-data/select/) and the [`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause).
|
The main query surrounds the subquery and requires at least the [`SELECT` clause](/influxdb/version/query-data/influxql/explore-data/select/) and the [`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause).
|
||||||
The main query supports all clauses listed in InfluxQL 2.x documentation.
|
The main query supports all clauses listed in InfluxQL 2.x documentation.
|
||||||
|
|
||||||
The subquery appears in the main query's `FROM` clause, and it requires surrounding parentheses.
|
The subquery appears in the main query's `FROM` clause, and it requires surrounding parentheses.
|
||||||
|
@ -146,7 +146,7 @@ Name: pet_daycare
|
||||||
|
|
||||||
|
|
||||||
Next, InfluxDB performs the main query and calculates the average of those differences.
|
Next, InfluxDB performs the main query and calculates the average of those differences.
|
||||||
Notice that the main query specifies `difference` as the field key in the [`MEAN()`](/influxdb/v2/query-data/influxql/functions/aggregates/#mean) function.
|
Notice that the main query specifies `difference` as the field key in the [`MEAN()`](/influxdb/version/query-data/influxql/functions/aggregates/#mean) function.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ tags: location=santa_monica
|
||||||
|
|
||||||
|
|
||||||
Next, InfluxDB performs the main query and calculates the sum of the `water_level_derivative` values for each tag value of `location`.
|
Next, InfluxDB performs the main query and calculates the sum of the `water_level_derivative` values for each tag value of `location`.
|
||||||
Notice that the main query specifies `water_level_derivative`, not `water_level` or `derivative`, as the field key in the [`SUM()`](/influxdb/v2/query-data/influxql/functions/aggregates/#sum) function.
|
Notice that the main query specifies `water_level_derivative`, not `water_level` or `derivative`, as the field key in the [`SUM()`](/influxdb/version/query-data/influxql/functions/aggregates/#sum) function.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ SELECT_clause FROM ( SELECT_clause FROM ( SELECT_statement ) [...] ) [...]
|
||||||
Subquery 1 Subquery 2
|
Subquery 1 Subquery 2
|
||||||
```
|
```
|
||||||
|
|
||||||
InfluxQL does not support multiple [`SELECT` statements](/influxdb/v2/query-data/influxql/explore-data/select/) per subquery:
|
InfluxQL does not support multiple [`SELECT` statements](/influxdb/version/query-data/influxql/explore-data/select/) per subquery:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT_clause FROM (SELECT_statement; SELECT_statement) [...]
|
SELECT_clause FROM (SELECT_statement; SELECT_statement) [...]
|
||||||
|
|
|
@ -11,25 +11,25 @@ You can review the following ways to work with time and timestamps in your Influ
|
||||||
|
|
||||||
## Configuring returned timestamps
|
## Configuring returned timestamps
|
||||||
|
|
||||||
The [InfluxQL shell](/influxdb/v2/tools/influxql-shell/) returns timestamps in
|
The [InfluxQL shell](/influxdb/version/tools/influxql-shell/) returns timestamps in
|
||||||
nanosecond UNIX epoch format by default.
|
nanosecond UNIX epoch format by default.
|
||||||
Specify alternative formats with the
|
Specify alternative formats with the
|
||||||
[`precision <format>` command](/influxdb/v2/tools/influxql-shell/#precision).
|
[`precision <format>` command](/influxdb/version/tools/influxql-shell/#precision).
|
||||||
|
|
||||||
If you are using the [InfluxQL shell](/influxdb/v2/tools/influxql-shell/), use the precision helper command `precision rfc3339` to view results in human readable format.
|
If you are using the [InfluxQL shell](/influxdb/version/tools/influxql-shell/), use the precision helper command `precision rfc3339` to view results in human readable format.
|
||||||
|
|
||||||
The [InfluxDB API](/influxdb/v2/reference/api/influxdb-1x/) returns timestamps
|
The [InfluxDB API](/influxdb/version/reference/api/influxdb-1x/) returns timestamps
|
||||||
in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format by default.
|
in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format by default.
|
||||||
Specify alternative formats with the
|
Specify alternative formats with the
|
||||||
[`epoch` query string parameter](/influxdb/v2/reference/api/influxdb-1x/).
|
[`epoch` query string parameter](/influxdb/version/reference/api/influxdb-1x/).
|
||||||
|
|
||||||
## Time syntax
|
## Time syntax
|
||||||
|
|
||||||
For most `SELECT` statements, the default time range is between [`1677-09-21 00:12:43.145224194` and `2262-04-11T23:47:16.854775806Z` UTC](/influxdb/v2/reference/faq/#what-are-the-minimum-and-maximum-timestamps-that-influxdb-can-store).
|
For most `SELECT` statements, the default time range is between [`1677-09-21 00:12:43.145224194` and `2262-04-11T23:47:16.854775806Z` UTC](/influxdb/version/reference/faq/#what-are-the-minimum-and-maximum-timestamps-that-influxdb-can-store).
|
||||||
For `SELECT` statements with a [`GROUP BY time()` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/),
|
For `SELECT` statements with a [`GROUP BY time()` clause](/influxdb/version/query-data/influxql/explore-data/group-by/),
|
||||||
the default time range is between `1677-09-21 00:12:43.145224194` UTC and [`now()`](/influxdb/v2/reference/glossary/#now).
|
the default time range is between `1677-09-21 00:12:43.145224194` UTC and [`now()`](/influxdb/version/reference/glossary/#now).
|
||||||
The following sections detail how to specify alternative time ranges in the `SELECT`
|
The following sections detail how to specify alternative time ranges in the `SELECT`
|
||||||
statement's [`WHERE` clause](/influxdb/v2/query-data/influxql/explore-data/where/).
|
statement's [`WHERE` clause](/influxdb/version/query-data/influxql/explore-data/where/).
|
||||||
|
|
||||||
Other supported features include:
|
Other supported features include:
|
||||||
[Absolute time](#absolute-time)
|
[Absolute time](#absolute-time)
|
||||||
|
@ -58,7 +58,7 @@ SELECT_clause FROM_clause WHERE time <operator> ['<rfc3339_date_time_string>' |
|
||||||
| `<=` | less than or equal to |
|
| `<=` | less than or equal to |
|
||||||
|
|
||||||
Currently, InfluxDB does not support using `OR` with absolute time in the `WHERE`
|
Currently, InfluxDB does not support using `OR` with absolute time in the `WHERE`
|
||||||
clause. See the [Frequently Asked Questions](/influxdb/v2/reference/faq/#why-is-my-query-with-a-where-or-time-clause-returning-empty-results)
|
clause. See the [Frequently Asked Questions](/influxdb/version/reference/faq/#why-is-my-query-with-a-where-or-time-clause-returning-empty-results)
|
||||||
document and the [GitHub Issue](https://github.com/influxdata/influxdb/issues/7530)
|
document and the [GitHub Issue](https://github.com/influxdata/influxdb/issues/7530)
|
||||||
for more information.
|
for more information.
|
||||||
|
|
||||||
|
@ -85,12 +85,12 @@ The RFC3339-like date-time string requires single quotes.
|
||||||
Epoch time is the amount of time that has elapsed since 00:00:00
|
Epoch time is the amount of time that has elapsed since 00:00:00
|
||||||
Coordinated Universal Time (UTC), Thursday, 1 January 1970.
|
Coordinated Universal Time (UTC), Thursday, 1 January 1970.
|
||||||
|
|
||||||
By default, InfluxDB assumes that all epoch timestamps are in **nanoseconds**. Include a [duration literal](/influxdb/v2/reference/glossary/#duration) at the end of the epoch timestamp to indicate a precision other than nanoseconds.
|
By default, InfluxDB assumes that all epoch timestamps are in **nanoseconds**. Include a [duration literal](/influxdb/version/reference/glossary/#duration) at the end of the epoch timestamp to indicate a precision other than nanoseconds.
|
||||||
|
|
||||||
#### Basic arithmetic
|
#### Basic arithmetic
|
||||||
|
|
||||||
All timestamp formats support basic arithmetic.
|
All timestamp formats support basic arithmetic.
|
||||||
Add (`+`) or subtract (`-`) a time from a timestamp with a [duration literal](/influxdb/v2/reference/glossary/#duration).
|
Add (`+`) or subtract (`-`) a time from a timestamp with a [duration literal](/influxdb/version/reference/glossary/#duration).
|
||||||
Note that InfluxQL requires a whitespace between the `+` or `-` and the
|
Note that InfluxQL requires a whitespace between the `+` or `-` and the
|
||||||
duration literal.
|
duration literal.
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ September 18, 2019 at 21:24:00. Note that the whitespace between the `-` and `6m
|
||||||
|
|
||||||
## Relative time
|
## Relative time
|
||||||
|
|
||||||
Use [`now()`](/influxdb/v2/reference/glossary/#now) to query data with [timestamps](/influxdb/v2/reference/glossary/#timestamp) relative to the server's current timestamp.
|
Use [`now()`](/influxdb/version/reference/glossary/#now) to query data with [timestamps](/influxdb/version/reference/glossary/#timestamp) relative to the server's current timestamp.
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ SELECT_clause FROM_clause WHERE time <operator> now() [[ - | + ] <duration_liter
|
||||||
```
|
```
|
||||||
|
|
||||||
`now()` is the Unix time of the server at the time the query is executed on that server.
|
`now()` is the Unix time of the server at the time the query is executed on that server.
|
||||||
The whitespace between `-` or `+` and the [duration literal](/influxdb/v2/reference/glossary/#duration) is required.
|
The whitespace between `-` or `+` and the [duration literal](/influxdb/version/reference/glossary/#duration) is required.
|
||||||
|
|
||||||
#### Supported operators
|
#### Supported operators
|
||||||
| Operator | Meaning |
|
| Operator | Meaning |
|
||||||
|
@ -368,13 +368,13 @@ The query results include the UTC offset (`-05:00`) for the `America/Chicago` ti
|
||||||
|
|
||||||
InfluxDB does not support using the `OR` operator in the `WHERE` clause to specify multiple time intervals.
|
InfluxDB does not support using the `OR` operator in the `WHERE` clause to specify multiple time intervals.
|
||||||
|
|
||||||
For more information, see [Frequently asked questions](/influxdb/v2/reference/faq/#why-is-my-query-with-a-where-or-time-clause-returning-empty-results).
|
For more information, see [Frequently asked questions](/influxdb/version/reference/faq/#why-is-my-query-with-a-where-or-time-clause-returning-empty-results).
|
||||||
|
|
||||||
### Querying data that occur after `now()` with a `GROUP BY time()` clause
|
### Querying data that occur after `now()` with a `GROUP BY time()` clause
|
||||||
|
|
||||||
Most `SELECT` statements have a default time range between [`1677-09-21 00:12:43.145224194` and `2262-04-11T23:47:16.854775806Z` UTC](/influxdb/v2/reference/faq/#what-are-the-minimum-and-maximum-timestamps-that-influxdb-can-store).
|
Most `SELECT` statements have a default time range between [`1677-09-21 00:12:43.145224194` and `2262-04-11T23:47:16.854775806Z` UTC](/influxdb/version/reference/faq/#what-are-the-minimum-and-maximum-timestamps-that-influxdb-can-store).
|
||||||
For `SELECT` statements with a [`GROUP BY time()` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals),
|
For `SELECT` statements with a [`GROUP BY time()` clause](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals),
|
||||||
the default time range is between `1677-09-21 00:12:43.145224194` UTC and [`now()`](/influxdb/v2/reference/glossary/#now).
|
the default time range is between `1677-09-21 00:12:43.145224194` UTC and [`now()`](/influxdb/version/reference/glossary/#now).
|
||||||
|
|
||||||
To query data with timestamps that occur after `now()`, `SELECT` statements with
|
To query data with timestamps that occur after `now()`, `SELECT` statements with
|
||||||
a `GROUP BY time()` clause must provide an alternative upper bound in the
|
a `GROUP BY time()` clause must provide an alternative upper bound in the
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
Use the `WHERE` clause to filter data based on
|
Use the `WHERE` clause to filter data based on
|
||||||
[fields](/influxdb/v2/reference/glossary/#field),
|
[fields](/influxdb/version/reference/glossary/#field),
|
||||||
[tags](/influxdb/v2/reference/glossary/#tag), and/or
|
[tags](/influxdb/version/reference/glossary/#tag), and/or
|
||||||
[timestamps](/influxdb/v2/reference/glossary/#timestamp).
|
[timestamps](/influxdb/version/reference/glossary/#timestamp).
|
||||||
|
|
||||||
- [Syntax](#syntax)
|
- [Syntax](#syntax)
|
||||||
- [Examples](#examples)
|
- [Examples](#examples)
|
||||||
|
@ -30,7 +30,7 @@ SELECT * FROM "mydb" WHERE time = '2020-07-31T20:07:00Z' OR time = '2020-07-31T2
|
||||||
field_key <operator> ['string' | boolean | float | integer]
|
field_key <operator> ['string' | boolean | float | integer]
|
||||||
```
|
```
|
||||||
|
|
||||||
The `WHERE` clause supports comparisons against string, boolean, float, and integer [field values](/influxdb/v2/reference/glossary/#field-value).
|
The `WHERE` clause supports comparisons against string, boolean, float, and integer [field values](/influxdb/version/reference/glossary/#field-value).
|
||||||
|
|
||||||
Single quote string field values in the `WHERE` clause.
|
Single quote string field values in the `WHERE` clause.
|
||||||
Queries with unquoted string field values or double quoted string field values will not return any data and, in most cases,
|
Queries with unquoted string field values or double quoted string field values will not return any data and, in most cases,
|
||||||
|
@ -48,7 +48,7 @@ Queries with unquoted string field values or double quoted string field values w
|
||||||
| `<` | less than |
|
| `<` | less than |
|
||||||
| `<=` | less than or equal to |
|
| `<=` | less than or equal to |
|
||||||
|
|
||||||
InfluxQL also supports [Regular Expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
InfluxQL also supports [Regular Expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||||
|
|
||||||
#### Tags
|
#### Tags
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ InfluxQL also supports [Regular Expressions](/influxdb/v2/query-data/influxql/ex
|
||||||
tag_key <operator> ['tag_value']
|
tag_key <operator> ['tag_value']
|
||||||
```
|
```
|
||||||
|
|
||||||
Single quote [tag values](/influxdb/v2/reference/glossary/#tag-value) in
|
Single quote [tag values](/influxdb/version/reference/glossary/#tag-value) in
|
||||||
the `WHERE` clause.
|
the `WHERE` clause.
|
||||||
Queries with unquoted tag values or double quoted tag values will not return
|
Queries with unquoted tag values or double quoted tag values will not return
|
||||||
any data and, in most cases,
|
any data and, in most cases,
|
||||||
|
@ -72,11 +72,11 @@ any data and, in most cases,
|
||||||
|
|
||||||
#### Timestamps
|
#### Timestamps
|
||||||
|
|
||||||
For most `SELECT` statements, the default time range is between [`1677-09-21 00:12:43.145224194` and `2262-04-11T23:47:16.854775806Z` UTC](/influxdb/v2/reference/faq/#what-are-the-minimum-and-maximum-integers-that-influxdb-can-store).
|
For most `SELECT` statements, the default time range is between [`1677-09-21 00:12:43.145224194` and `2262-04-11T23:47:16.854775806Z` UTC](/influxdb/version/reference/faq/#what-are-the-minimum-and-maximum-integers-that-influxdb-can-store).
|
||||||
For `SELECT` statements with a [`GROUP BY time()` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/), the default time
|
For `SELECT` statements with a [`GROUP BY time()` clause](/influxdb/version/query-data/influxql/explore-data/group-by/), the default time
|
||||||
range is between `1677-09-21 00:12:43.145224194` UTC and [`now()`](/influxdb/v2/reference/glossary/#now).
|
range is between `1677-09-21 00:12:43.145224194` UTC and [`now()`](/influxdb/version/reference/glossary/#now).
|
||||||
|
|
||||||
See [Time Syntax](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax) for information on how to specify alternative time ranges in the `WHERE` clause.
|
See [Time Syntax](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax) for information on how to specify alternative time ranges in the `WHERE` clause.
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ Name: h2o_feet
|
||||||
The query returns data from the `h2o_feet` measurement with field values of
|
The query returns data from the `h2o_feet` measurement with field values of
|
||||||
`water_level` plus two that are greater than 11.9. Note that InfluxDB follows the standard order of operations.
|
`water_level` plus two that are greater than 11.9. Note that InfluxDB follows the standard order of operations.
|
||||||
|
|
||||||
See [Mathematical operators](/influxdb/v2/query-data/influxql/math-operators/)
|
See [Mathematical operators](/influxdb/version/query-data/influxql/math-operators/)
|
||||||
for more on supported operators.
|
for more on supported operators.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
@ -186,7 +186,7 @@ time water_level
|
||||||
2019-09-18T21:42:00Z 4.938 -->
|
2019-09-18T21:42:00Z 4.938 -->
|
||||||
|
|
||||||
The query returns data from the `h2o_feet` measurement where the
|
The query returns data from the `h2o_feet` measurement where the
|
||||||
[tag key](/influxdb/v2/reference/glossary/#tag-key) `location` is set to `santa_monica`.
|
[tag key](/influxdb/version/reference/glossary/#tag-key) `location` is set to `santa_monica`.
|
||||||
InfluxQL requires single quotes around tag values in the `WHERE` clause.
|
InfluxQL requires single quotes around tag values in the `WHERE` clause.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
@ -225,8 +225,8 @@ separating logic with parentheses.
|
||||||
SELECT * FROM "h2o_feet" WHERE time > now() - 7d
|
SELECT * FROM "h2o_feet" WHERE time > now() - 7d
|
||||||
```
|
```
|
||||||
|
|
||||||
The query returns data from the `h2o_feet` measurement with [timestamps](/influxdb/v2/reference/glossary/#timestamp)
|
The query returns data from the `h2o_feet` measurement with [timestamps](/influxdb/version/reference/glossary/#timestamp)
|
||||||
within the past seven days. See [Time Syntax](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax) for more in-depth information on supported time syntax in the `WHERE` clause.
|
within the past seven days. See [Time Syntax](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax) for more in-depth information on supported time syntax in the `WHERE` clause.
|
||||||
|
|
||||||
### Common issues with the `WHERE` clause
|
### Common issues with the `WHERE` clause
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,13 @@ Use the following InfluxQL commands to explore your schema:
|
||||||
- [SHOW TAG KEY CARDINALITY](#show-tag-key-cardinality)
|
- [SHOW TAG KEY CARDINALITY](#show-tag-key-cardinality)
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
Command examples use the [NOAA water sample data](/influxdb/v2/reference/sample-data/#noaa-water-sample-data).
|
Command examples use the [NOAA water sample data](/influxdb/version/reference/sample-data/#noaa-water-sample-data).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
## SHOW SERIES
|
## SHOW SERIES
|
||||||
|
|
||||||
Return a list of [series](/influxdb/v2/reference/glossary/#series) for
|
Return a list of [series](/influxdb/version/reference/glossary/#series) for
|
||||||
the specified [database](/influxdb/v2/reference/glossary/#database).
|
the specified [database](/influxdb/version/reference/glossary/#database).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ SHOW SERIES [ON <database_name>] [FROM_clause] [WHERE <tag_key> <operator> [ '<t
|
||||||
- `ON <database_name>` is optional.
|
- `ON <database_name>` is optional.
|
||||||
If the query does not include `ON <database_name>`, you must specify the
|
If the query does not include `ON <database_name>`, you must specify the
|
||||||
database with the `db` query string parameter in the
|
database with the `db` query string parameter in the
|
||||||
[InfluxDB API](/influxdb/v2/reference/api/influxdb-1x/) request.
|
[InfluxDB API](/influxdb/version/reference/api/influxdb-1x/) request.
|
||||||
- `FROM`, `WHERE`, `LIMIT`, and `OFFSET` clauses are optional.
|
- `FROM`, `WHERE`, `LIMIT`, and `OFFSET` clauses are optional.
|
||||||
- The `WHERE` clause in `SHOW SERIES` supports tag comparisons but not field comparisons.
|
- The `WHERE` clause in `SHOW SERIES` supports tag comparisons but not field comparisons.
|
||||||
|
|
||||||
|
@ -40,11 +40,11 @@ SHOW SERIES [ON <database_name>] [FROM_clause] [WHERE <tag_key> <operator> [ '<t
|
||||||
- `=~`: matches against
|
- `=~`: matches against
|
||||||
- `!~`: doesn't match against
|
- `!~`: doesn't match against
|
||||||
|
|
||||||
See [Explore data using InfluxQL](/influxdb/v2/query-data/influxql/explore-data/) for documentation on the
|
See [Explore data using InfluxQL](/influxdb/version/query-data/influxql/explore-data/) for documentation on the
|
||||||
[`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause),
|
[`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause),
|
||||||
[`LIMIT` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/),
|
[`LIMIT` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/),
|
||||||
[`OFFSET` clause](/influxdb/v2/query-data/influxql/explore-data/offset-and-soffset/),
|
[`OFFSET` clause](/influxdb/version/query-data/influxql/explore-data/offset-and-soffset/),
|
||||||
and [Regular Expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
and [Regular Expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
@ -57,9 +57,9 @@ SHOW SERIES ON noaa
|
||||||
**Output:**
|
**Output:**
|
||||||
|
|
||||||
The query returns all series in the `noaa` database.
|
The query returns all series in the `noaa` database.
|
||||||
The query's output is similar to the [line protocol](/influxdb/v2/reference/syntax/line-protocol/) format.
|
The query's output is similar to the [line protocol](/influxdb/version/reference/syntax/line-protocol/) format.
|
||||||
Everything before the first comma is the [measurement](/influxdb/v2/reference/glossary/#measurement) name.
|
Everything before the first comma is the [measurement](/influxdb/version/reference/glossary/#measurement) name.
|
||||||
Everything after the first comma is either a [tag key](/influxdb/v2/reference/glossary/#tag-key) or a [tag value](/influxdb/v2/reference/glossary/#tag-value).
|
Everything after the first comma is either a [tag key](/influxdb/version/reference/glossary/#tag-key) or a [tag value](/influxdb/version/reference/glossary/#tag-value).
|
||||||
The `noaa` database has 5 different measurements and 13 different series.
|
The `noaa` database has 5 different measurements and 13 different series.
|
||||||
|
|
||||||
| key |
|
| key |
|
||||||
|
@ -97,8 +97,8 @@ The `LIMIT` clause limits the number of series returned to two.
|
||||||
|
|
||||||
## SHOW MEASUREMENTS
|
## SHOW MEASUREMENTS
|
||||||
|
|
||||||
Returns a list of [measurements](/influxdb/v2/reference/glossary/#measurement)
|
Returns a list of [measurements](/influxdb/version/reference/glossary/#measurement)
|
||||||
for the specified [database](/influxdb/v2/reference/glossary/#database).
|
for the specified [database](/influxdb/version/reference/glossary/#database).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ SHOW MEASUREMENTS [ON <database_name>] [WITH MEASUREMENT <operator> ['<measureme
|
||||||
- `ON <database_name>` is optional.
|
- `ON <database_name>` is optional.
|
||||||
If the query does not include `ON <database_name>`, you must specify the
|
If the query does not include `ON <database_name>`, you must specify the
|
||||||
database with the `db` query string parameter in the
|
database with the `db` query string parameter in the
|
||||||
[InfluxDB API](/influxdb/v2/reference/api/influxdb-1x/) request.
|
[InfluxDB API](/influxdb/version/reference/api/influxdb-1x/) request.
|
||||||
|
|
||||||
- The `WITH`, `WHERE`, `LIMIT` and `OFFSET` clauses are optional.
|
- The `WITH`, `WHERE`, `LIMIT` and `OFFSET` clauses are optional.
|
||||||
- The `WHERE` in `SHOW MEASUREMENTS` supports tag comparisons, but not field comparisons.
|
- The `WHERE` in `SHOW MEASUREMENTS` supports tag comparisons, but not field comparisons.
|
||||||
|
@ -122,11 +122,11 @@ SHOW MEASUREMENTS [ON <database_name>] [WITH MEASUREMENT <operator> ['<measureme
|
||||||
- `=~`: matches against
|
- `=~`: matches against
|
||||||
- `!~`: doesn't match against
|
- `!~`: doesn't match against
|
||||||
|
|
||||||
See [Explore data using InfluxQL](/influxdb/v2/query-data/influxql/explore-data/) for documentation on the
|
See [Explore data using InfluxQL](/influxdb/version/query-data/influxql/explore-data/) for documentation on the
|
||||||
[`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause),
|
[`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause),
|
||||||
[`LIMIT` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/),
|
[`LIMIT` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/),
|
||||||
[`OFFSET` clause](/influxdb/v2/query-data/influxql/explore-data/offset-and-soffset/),
|
[`OFFSET` clause](/influxdb/version/query-data/influxql/explore-data/offset-and-soffset/),
|
||||||
and [Regular Expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
and [Regular Expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
@ -183,8 +183,8 @@ values for the tag key `randtag` that include an integer.
|
||||||
|
|
||||||
## SHOW TAG KEYS
|
## SHOW TAG KEYS
|
||||||
|
|
||||||
Returns a list of [tag keys](/influxdb/v2/reference/glossary/#tag-key)
|
Returns a list of [tag keys](/influxdb/version/reference/glossary/#tag-key)
|
||||||
associated with the specified [database](/influxdb/v2/reference/glossary/#database).
|
associated with the specified [database](/influxdb/version/reference/glossary/#database).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ SHOW TAG KEYS [ON <database_name>] [FROM_clause] WITH KEY [ [<operator> "<tag_ke
|
||||||
|
|
||||||
- `ON <database_name>` is optional.
|
- `ON <database_name>` is optional.
|
||||||
If the query does not include `ON <database_name>`, you must specify the
|
If the query does not include `ON <database_name>`, you must specify the
|
||||||
database with `db` query string parameter in the [InfluxDB API](/influxdb/v2/reference/api/influxdb-1x/) request.
|
database with `db` query string parameter in the [InfluxDB API](/influxdb/version/reference/api/influxdb-1x/) request.
|
||||||
- The `FROM` clause and the `WHERE` clause are optional.
|
- The `FROM` clause and the `WHERE` clause are optional.
|
||||||
- The `WHERE` clause in `SHOW TAG KEYS` supports tag comparisons, but not field comparisons.
|
- The `WHERE` clause in `SHOW TAG KEYS` supports tag comparisons, but not field comparisons.
|
||||||
|
|
||||||
|
@ -206,11 +206,11 @@ SHOW TAG KEYS [ON <database_name>] [FROM_clause] WITH KEY [ [<operator> "<tag_ke
|
||||||
- `=~`: matches against
|
- `=~`: matches against
|
||||||
- `!~`: doesn't match against
|
- `!~`: doesn't match against
|
||||||
|
|
||||||
See [Explore data using InfluxQL](/influxdb/v2/query-data/influxql/explore-data/) for documentation on the
|
See [Explore data using InfluxQL](/influxdb/version/query-data/influxql/explore-data/) for documentation on the
|
||||||
[`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause),
|
[`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause),
|
||||||
[`LIMIT` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/),
|
[`LIMIT` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/),
|
||||||
[`OFFSET` clause](/influxdb/v2/query-data/influxql/explore-data/offset-and-soffset/),
|
[`OFFSET` clause](/influxdb/version/query-data/influxql/explore-data/offset-and-soffset/),
|
||||||
and [Regular Expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
and [Regular Expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
@ -273,8 +273,8 @@ SHOW TAG KEYS ON noaa WITH KEY IN ("location")
|
||||||
|
|
||||||
## SHOW TAG VALUES
|
## SHOW TAG VALUES
|
||||||
|
|
||||||
Returns the list of [tag values](/influxdb/v2/reference/glossary/#tag-value)
|
Returns the list of [tag values](/influxdb/version/reference/glossary/#tag-value)
|
||||||
for the specified [tag key(s)](/influxdb/v2/reference/glossary/#tag-key) in the database.
|
for the specified [tag key(s)](/influxdb/version/reference/glossary/#tag-key) in the database.
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ SHOW TAG VALUES [ON <database_name>][FROM_clause] WITH KEY [ [<operator> "<tag_k
|
||||||
|
|
||||||
- `ON <database_name>` is optional.
|
- `ON <database_name>` is optional.
|
||||||
If the query does not include `ON <database_name>`, you must specify the
|
If the query does not include `ON <database_name>`, you must specify the
|
||||||
database with the `db` query string parameter in the [InfluxDB API](/influxdb/v2/reference/api/influxdb-1x/) request.
|
database with the `db` query string parameter in the [InfluxDB API](/influxdb/version/reference/api/influxdb-1x/) request.
|
||||||
- The `WITH` clause is required.
|
- The `WITH` clause is required.
|
||||||
It supports specifying a single tag key, a regular expression, and multiple tag keys.
|
It supports specifying a single tag key, a regular expression, and multiple tag keys.
|
||||||
- The `FROM`, `WHERE`, `LIMIT`, and `OFFSET` clauses are optional.
|
- The `FROM`, `WHERE`, `LIMIT`, and `OFFSET` clauses are optional.
|
||||||
|
@ -298,11 +298,11 @@ SHOW TAG VALUES [ON <database_name>][FROM_clause] WITH KEY [ [<operator> "<tag_k
|
||||||
- `=~`: matches against
|
- `=~`: matches against
|
||||||
- `!~`: doesn't match against
|
- `!~`: doesn't match against
|
||||||
|
|
||||||
See [Explore data using InfluxQL](/influxdb/v2/query-data/influxql/explore-data/) for documentation on the
|
See [Explore data using InfluxQL](/influxdb/version/query-data/influxql/explore-data/) for documentation on the
|
||||||
[`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause),
|
[`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause),
|
||||||
[`LIMIT` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/),
|
[`LIMIT` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/),
|
||||||
[`OFFSET` clause](/influxdb/v2/query-data/influxql/explore-data/offset-and-soffset/),
|
[`OFFSET` clause](/influxdb/version/query-data/influxql/explore-data/offset-and-soffset/),
|
||||||
and [Regular Expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
and [Regular Expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
@ -351,9 +351,9 @@ name: h2o_quality
|
||||||
|
|
||||||
## SHOW FIELD KEYS
|
## SHOW FIELD KEYS
|
||||||
|
|
||||||
Returns the [field keys](/influxdb/v2/reference/glossary/#field-key) and the
|
Returns the [field keys](/influxdb/version/reference/glossary/#field-key) and the
|
||||||
[data type](/influxdb/v2/reference/glossary/#data-type) of their
|
[data type](/influxdb/version/reference/glossary/#data-type) of their
|
||||||
[field values](/influxdb/v2/reference/glossary/#field-value).
|
[field values](/influxdb/version/reference/glossary/#field-value).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -363,16 +363,16 @@ SHOW FIELD KEYS [ON <database_name>] [FROM <measurement_name>]
|
||||||
|
|
||||||
- `ON <database_name>` is optional.
|
- `ON <database_name>` is optional.
|
||||||
If the query does not include `ON <database_name>`, you must specify the
|
If the query does not include `ON <database_name>`, you must specify the
|
||||||
database with `USE <database_name>` when using the [InfluxQL shell](/influxdb/v2/tools/influxql-shell/)
|
database with `USE <database_name>` when using the [InfluxQL shell](/influxdb/version/tools/influxql-shell/)
|
||||||
or with the `db` query string parameter in the
|
or with the `db` query string parameter in the
|
||||||
[InfluxDB 1.x compatibility API](/influxdb/v2/reference/api/influxdb-1x/) request.
|
[InfluxDB 1.x compatibility API](/influxdb/version/reference/api/influxdb-1x/) request.
|
||||||
- The `FROM` clause is optional.
|
- The `FROM` clause is optional.
|
||||||
See the Data Exploration page for documentation on the
|
See the Data Exploration page for documentation on the
|
||||||
[` FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause).
|
[` FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause).
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** A field's data type [can differ](/influxdb/v2/reference/faq/#how-does-influxdb-handle-field-type-discrepancies-across-shards) across
|
**Note:** A field's data type [can differ](/influxdb/version/reference/faq/#how-does-influxdb-handle-field-type-discrepancies-across-shards) across
|
||||||
[shards](/influxdb/v2/reference/glossary/#shard).
|
[shards](/influxdb/version/reference/glossary/#shard).
|
||||||
If your field has more than one type, `SHOW FIELD KEYS` returns the type that
|
If your field has more than one type, `SHOW FIELD KEYS` returns the type that
|
||||||
occurs first in the following list: float, integer, string, boolean.
|
occurs first in the following list: float, integer, string, boolean.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
@ -419,8 +419,8 @@ measurement in the `noaa` database.
|
||||||
|
|
||||||
#### SHOW FIELD KEYS and field type discrepancies
|
#### SHOW FIELD KEYS and field type discrepancies
|
||||||
|
|
||||||
Field value [data types](/influxdb/v2/reference/glossary/#data-type)
|
Field value [data types](/influxdb/version/reference/glossary/#data-type)
|
||||||
cannot differ within a [shard](/influxdb/v2/reference/glossary/#shard) but they
|
cannot differ within a [shard](/influxdb/version/reference/glossary/#shard) but they
|
||||||
can differ across shards.
|
can differ across shards.
|
||||||
`SHOW FIELD KEYS` returns every data type, across every shard, associated with
|
`SHOW FIELD KEYS` returns every data type, across every shard, associated with
|
||||||
the field key.
|
the field key.
|
||||||
|
@ -479,7 +479,7 @@ SHOW TAG VALUES EXACT CARDINALITY WITH KEY = "myTagKey" -->
|
||||||
|
|
||||||
<!-- ### Filter meta queries by time
|
<!-- ### Filter meta queries by time
|
||||||
|
|
||||||
When you filter meta queries by time, you may see results outside of your specified time. Meta query results are filtered at the shard level, so results can be approximately as granular as your shard group duration. If your time filter spans multiple shards, you'll get results from all shards with points in the specified time range. To review your shards and timestamps on points in the shard, run `SHOW SHARDS`. To learn more about shards and their duration, see [recommended shard groups durations](/influxdb/v2/reference/internals/shards/#shard-group-duration).
|
When you filter meta queries by time, you may see results outside of your specified time. Meta query results are filtered at the shard level, so results can be approximately as granular as your shard group duration. If your time filter spans multiple shards, you'll get results from all shards with points in the specified time range. To review your shards and timestamps on points in the shard, run `SHOW SHARDS`. To learn more about shards and their duration, see [recommended shard groups durations](/influxdb/version/reference/internals/shards/#shard-group-duration).
|
||||||
|
|
||||||
The example below shows how to filter `SHOW TAG KEYS` by approximately one hour using a 1h shard group duration. To filter other meta data, replace `SHOW TAG KEYS` with `SHOW TAG VALUES`, `SHOW SERIES`, `SHOW FIELD KEYS`, and so on.
|
The example below shows how to filter `SHOW TAG KEYS` by approximately one hour using a 1h shard group duration. To filter other meta data, replace `SHOW TAG KEYS` with `SHOW TAG VALUES`, `SHOW SERIES`, `SHOW FIELD KEYS`, and so on.
|
||||||
|
|
||||||
|
|
|
@ -2,64 +2,64 @@
|
||||||
Use InfluxQL functions to aggregate, select, transform, analyze, and predict data.
|
Use InfluxQL functions to aggregate, select, transform, analyze, and predict data.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
To query with InfluxQL, the bucket you query must be mapped to a database and retention policy (DBRP). For more information, see how to [Query data with InfluxQL](/influxdb/v2/query-data/influxql/).
|
To query with InfluxQL, the bucket you query must be mapped to a database and retention policy (DBRP). For more information, see how to [Query data with InfluxQL](/influxdb/version/query-data/influxql/).
|
||||||
{{%/ note %}}
|
{{%/ note %}}
|
||||||
|
|
||||||
## InfluxQL functions (by type)
|
## InfluxQL functions (by type)
|
||||||
|
|
||||||
- [Aggregates](/influxdb/v2/query-data/influxql/functions/aggregates/)
|
- [Aggregates](/influxdb/version/query-data/influxql/functions/aggregates/)
|
||||||
- [COUNT()](/influxdb/v2/query-data/influxql/functions/aggregates/#count)
|
- [COUNT()](/influxdb/version/query-data/influxql/functions/aggregates/#count)
|
||||||
- [DISTINCT()](/influxdb/v2/query-data/influxql/functions/aggregates/#distinct)
|
- [DISTINCT()](/influxdb/version/query-data/influxql/functions/aggregates/#distinct)
|
||||||
- [INTEGRAL()](/influxdb/v2/query-data/influxql/functions/aggregates/#integral)
|
- [INTEGRAL()](/influxdb/version/query-data/influxql/functions/aggregates/#integral)
|
||||||
- [MEAN()](/influxdb/v2/query-data/influxql/functions/aggregates/#mean)
|
- [MEAN()](/influxdb/version/query-data/influxql/functions/aggregates/#mean)
|
||||||
- [MEDIAN()](/influxdb/v2/query-data/influxql/functions/aggregates/#median)
|
- [MEDIAN()](/influxdb/version/query-data/influxql/functions/aggregates/#median)
|
||||||
- [MODE()](/influxdb/v2/query-data/influxql/functions/aggregates/#mode)
|
- [MODE()](/influxdb/version/query-data/influxql/functions/aggregates/#mode)
|
||||||
- [SPREAD()](/influxdb/v2/query-data/influxql/functions/aggregates/#spread)
|
- [SPREAD()](/influxdb/version/query-data/influxql/functions/aggregates/#spread)
|
||||||
- [STDDEV()](/influxdb/v2/query-data/influxql/functions/aggregates/#stddev)
|
- [STDDEV()](/influxdb/version/query-data/influxql/functions/aggregates/#stddev)
|
||||||
- [SUM()](/influxdb/v2/query-data/influxql/functions/aggregates/#sum)
|
- [SUM()](/influxdb/version/query-data/influxql/functions/aggregates/#sum)
|
||||||
- [Selectors](/influxdb/v2/query-data/influxql/functions/selectors/)
|
- [Selectors](/influxdb/version/query-data/influxql/functions/selectors/)
|
||||||
- [BOTTOM()](/influxdb/v2/query-data/influxql/functions/selectors/#bottom)
|
- [BOTTOM()](/influxdb/version/query-data/influxql/functions/selectors/#bottom)
|
||||||
- [FIRST()](/influxdb/v2/query-data/influxql/functions/selectors/#first)
|
- [FIRST()](/influxdb/version/query-data/influxql/functions/selectors/#first)
|
||||||
- [LAST()](/influxdb/v2/query-data/influxql/functions/selectors/#last)
|
- [LAST()](/influxdb/version/query-data/influxql/functions/selectors/#last)
|
||||||
- [MAX()](/influxdb/v2/query-data/influxql/functions/selectors/#max)
|
- [MAX()](/influxdb/version/query-data/influxql/functions/selectors/#max)
|
||||||
- [MIN()](/influxdb/v2/query-data/influxql/functions/selectors/#min)
|
- [MIN()](/influxdb/version/query-data/influxql/functions/selectors/#min)
|
||||||
- [PERCENTILE()](/influxdb/v2/query-data/influxql/functions/selectors/#percentile)
|
- [PERCENTILE()](/influxdb/version/query-data/influxql/functions/selectors/#percentile)
|
||||||
- [SAMPLE()](/influxdb/v2/query-data/influxql/functions/selectors/#sample)
|
- [SAMPLE()](/influxdb/version/query-data/influxql/functions/selectors/#sample)
|
||||||
- [TOP()](/influxdb/v2/query-data/influxql/functions/selectors/#top)
|
- [TOP()](/influxdb/version/query-data/influxql/functions/selectors/#top)
|
||||||
- [Transformations](/influxdb/v2/query-data/influxql/functions/transformations/)
|
- [Transformations](/influxdb/version/query-data/influxql/functions/transformations/)
|
||||||
- [ABS()](/influxdb/v2/query-data/influxql/functions/transformations/#abs)
|
- [ABS()](/influxdb/version/query-data/influxql/functions/transformations/#abs)
|
||||||
- [ACOS()](/influxdb/v2/query-data/influxql/functions/transformations/#acos)
|
- [ACOS()](/influxdb/version/query-data/influxql/functions/transformations/#acos)
|
||||||
- [ASIN()](/influxdb/v2/query-data/influxql/functions/transformations/#asin)
|
- [ASIN()](/influxdb/version/query-data/influxql/functions/transformations/#asin)
|
||||||
- [ATAN()](/influxdb/v2/query-data/influxql/functions/transformations/#atan)
|
- [ATAN()](/influxdb/version/query-data/influxql/functions/transformations/#atan)
|
||||||
- [ATAN2()](/influxdb/v2/query-data/influxql/functions/transformations/#atan2)
|
- [ATAN2()](/influxdb/version/query-data/influxql/functions/transformations/#atan2)
|
||||||
- [CEIL()](/influxdb/v2/query-data/influxql/functions/transformations/#ceil)
|
- [CEIL()](/influxdb/version/query-data/influxql/functions/transformations/#ceil)
|
||||||
- [COS()](/influxdb/v2/query-data/influxql/functions/transformations/#cos)
|
- [COS()](/influxdb/version/query-data/influxql/functions/transformations/#cos)
|
||||||
- [CUMULATIVE_SUM()](/influxdb/v2/query-data/influxql/functions/transformations/#cumulative_sum)
|
- [CUMULATIVE_SUM()](/influxdb/version/query-data/influxql/functions/transformations/#cumulative_sum)
|
||||||
- [DERIVATIVE()](/influxdb/v2/query-data/influxql/functions/transformations/#derivative)
|
- [DERIVATIVE()](/influxdb/version/query-data/influxql/functions/transformations/#derivative)
|
||||||
- [DIFFERENCE()](/influxdb/v2/query-data/influxql/functions/transformations/#difference)
|
- [DIFFERENCE()](/influxdb/version/query-data/influxql/functions/transformations/#difference)
|
||||||
- [ELAPSED()](/influxdb/v2/query-data/influxql/functions/transformations/#elapsed)
|
- [ELAPSED()](/influxdb/version/query-data/influxql/functions/transformations/#elapsed)
|
||||||
- [EXP()](/influxdb/v2/query-data/influxql/functions/transformations/#exp)
|
- [EXP()](/influxdb/version/query-data/influxql/functions/transformations/#exp)
|
||||||
- [FLOOR()](/influxdb/v2/query-data/influxql/functions/transformations/#floor)
|
- [FLOOR()](/influxdb/version/query-data/influxql/functions/transformations/#floor)
|
||||||
- [HISTOGRAM()](/influxdb/v2/query-data/influxql/functions/transformations/#histogram)
|
- [HISTOGRAM()](/influxdb/version/query-data/influxql/functions/transformations/#histogram)
|
||||||
- [LN()](/influxdb/v2/query-data/influxql/functions/transformations/#ln)
|
- [LN()](/influxdb/version/query-data/influxql/functions/transformations/#ln)
|
||||||
- [LOG()](/influxdb/v2/query-data/influxql/functions/transformations/#log)
|
- [LOG()](/influxdb/version/query-data/influxql/functions/transformations/#log)
|
||||||
- [LOG2()](/influxdb/v2/query-data/influxql/functions/transformations/#log2)
|
- [LOG2()](/influxdb/version/query-data/influxql/functions/transformations/#log2)
|
||||||
- [LOG10()](/influxdb/v2/query-data/influxql/functions/transformations/#log10)
|
- [LOG10()](/influxdb/version/query-data/influxql/functions/transformations/#log10)
|
||||||
- [MOVING_AVERAGE()](/influxdb/v2/query-data/influxql/functions/transformations/#moving_average)
|
- [MOVING_AVERAGE()](/influxdb/version/query-data/influxql/functions/transformations/#moving_average)
|
||||||
- [NON_NEGATIVE_DERIVATIVE()](/influxdb/v2/query-data/influxql/functions/transformations/#non_negative_derivative)
|
- [NON_NEGATIVE_DERIVATIVE()](/influxdb/version/query-data/influxql/functions/transformations/#non_negative_derivative)
|
||||||
- [NON_NEGATIVE_DIFFERENCE()](/influxdb/v2/query-data/influxql/functions/transformations/#non_negative_difference)
|
- [NON_NEGATIVE_DIFFERENCE()](/influxdb/version/query-data/influxql/functions/transformations/#non_negative_difference)
|
||||||
- [POW()](/influxdb/v2/query-data/influxql/functions/transformations/#pow)
|
- [POW()](/influxdb/version/query-data/influxql/functions/transformations/#pow)
|
||||||
- [ROUND()](/influxdb/v2/query-data/influxql/functions/transformations/#round)
|
- [ROUND()](/influxdb/version/query-data/influxql/functions/transformations/#round)
|
||||||
- [SIN()](/influxdb/v2/query-data/influxql/functions/transformations/#sin)
|
- [SIN()](/influxdb/version/query-data/influxql/functions/transformations/#sin)
|
||||||
- [SQRT()](/influxdb/v2/query-data/influxql/functions/transformations/#sqrt)
|
- [SQRT()](/influxdb/version/query-data/influxql/functions/transformations/#sqrt)
|
||||||
- [TAN()](/influxdb/v2/query-data/influxql/functions/transformations/#tan)
|
- [TAN()](/influxdb/version/query-data/influxql/functions/transformations/#tan)
|
||||||
- [Technical analysis](/influxdb/v2/query-data/influxql/functions/technical-analysis/)
|
- [Technical analysis](/influxdb/version/query-data/influxql/functions/technical-analysis/)
|
||||||
- (Predictive analysis) [HOLT_WINTERS()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#holt_winters)
|
- (Predictive analysis) [HOLT_WINTERS()](/influxdb/version/query-data/influxql/functions/technical-analysis/#holt_winters)
|
||||||
- [CHANDE_MOMENTUM_OSCILLATOR()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#chande_momentum_oscillator)
|
- [CHANDE_MOMENTUM_OSCILLATOR()](/influxdb/version/query-data/influxql/functions/technical-analysis/#chande_momentum_oscillator)
|
||||||
- [EXPONENTIAL_MOVING_AVERAGE()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#exponential_moving_average)
|
- [EXPONENTIAL_MOVING_AVERAGE()](/influxdb/version/query-data/influxql/functions/technical-analysis/#exponential_moving_average)
|
||||||
- [DOUBLE_EXPONENTIAL_MOVING_AVERAGE()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#double_exponential_moving_average)
|
- [DOUBLE_EXPONENTIAL_MOVING_AVERAGE()](/influxdb/version/query-data/influxql/functions/technical-analysis/#double_exponential_moving_average)
|
||||||
- [KAUFMANS_EFFICIENCY_RATIO()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#kaufmans_adaptive_moving_average)
|
- [KAUFMANS_EFFICIENCY_RATIO()](/influxdb/version/query-data/influxql/functions/technical-analysis/#kaufmans_adaptive_moving_average)
|
||||||
- [KAUFMANS_ADAPTIVE_MOVING_AVERAGE()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#kaufmans_adaptive_moving_average)
|
- [KAUFMANS_ADAPTIVE_MOVING_AVERAGE()](/influxdb/version/query-data/influxql/functions/technical-analysis/#kaufmans_adaptive_moving_average)
|
||||||
- [TRIPLE_EXPONENTIAL_MOVING_AVERAGE()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#triple_exponential_moving_average)
|
- [TRIPLE_EXPONENTIAL_MOVING_AVERAGE()](/influxdb/version/query-data/influxql/functions/technical-analysis/#triple_exponential_moving_average)
|
||||||
- [TRIPLE_EXPONENTIAL_DERIVATIVE()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#triple_exponential_derivative)
|
- [TRIPLE_EXPONENTIAL_DERIVATIVE()](/influxdb/version/query-data/influxql/functions/technical-analysis/#triple_exponential_derivative)
|
||||||
- [RELATIVE_STRENGTH_INDEX()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#relative_strength_index)
|
- [RELATIVE_STRENGTH_INDEX()](/influxdb/version/query-data/influxql/functions/technical-analysis/#relative_strength_index)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Use aggregate functions to assess, aggregate, and return values in your data.
|
Use aggregate functions to assess, aggregate, and return values in your data.
|
||||||
Aggregate functions return one row containing the aggregate values from each InfluxQL group.
|
Aggregate functions return one row containing the aggregate values from each InfluxQL group.
|
||||||
|
|
||||||
Each aggregate function below covers **syntax** including parameters to pass to the function, and **examples** of how to use the function. Examples use [NOAA water sample data](/influxdb/v2/reference/sample-data/#noaa-water-sample-data).
|
Each aggregate function below covers **syntax** including parameters to pass to the function, and **examples** of how to use the function. Examples use [NOAA water sample data](/influxdb/version/reference/sample-data/#noaa-water-sample-data).
|
||||||
|
|
||||||
- [COUNT()](#count)
|
- [COUNT()](#count)
|
||||||
- [DISTINCT()](#distinct)
|
- [DISTINCT()](#distinct)
|
||||||
|
@ -16,7 +16,7 @@ Each aggregate function below covers **syntax** including parameters to pass to
|
||||||
|
|
||||||
## COUNT()
|
## COUNT()
|
||||||
|
|
||||||
Returns the number of non-null [field values](/influxdb/v2/reference/glossary/#field-value). Supports all field value [data types](/influxdb/v2/reference/glossary/#data-type).
|
Returns the number of non-null [field values](/influxdb/version/reference/glossary/#field-value). Supports all field value [data types](/influxdb/version/reference/glossary/#data-type).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -26,15 +26,15 @@ SELECT COUNT( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE_
|
||||||
|
|
||||||
`COUNT(*)`
|
`COUNT(*)`
|
||||||
|
|
||||||
Returns the number of field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the number of field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
`COUNT(field_key)`
|
`COUNT(field_key)`
|
||||||
|
|
||||||
Returns the number of field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the number of field values associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`COUNT(/regular_expression/)`
|
`COUNT(/regular_expression/)`
|
||||||
|
|
||||||
Returns the number of field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/#regular-expressions).
|
Returns the number of field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/#regular-expressions).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -119,8 +119,8 @@ name: h2o_feet
|
||||||
|
|
||||||
## DISTINCT()
|
## DISTINCT()
|
||||||
|
|
||||||
Returns the list of unique [field values](/influxdb/v2/reference/glossary/#field-value).
|
Returns the list of unique [field values](/influxdb/version/reference/glossary/#field-value).
|
||||||
Supports all field value [data types](/influxdb/v2/reference/glossary/#data-type).
|
Supports all field value [data types](/influxdb/version/reference/glossary/#data-type).
|
||||||
|
|
||||||
InfluxQL supports nesting `DISTINCT()` with [`COUNT()`](#count).
|
InfluxQL supports nesting `DISTINCT()` with [`COUNT()`](#count).
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ SELECT DISTINCT( [ <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE_c
|
||||||
|
|
||||||
`DISTINCT(field_key)`
|
`DISTINCT(field_key)`
|
||||||
|
|
||||||
Returns the unique field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the unique field values associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -187,10 +187,10 @@ name: h2o_feet
|
||||||
|
|
||||||
## INTEGRAL()
|
## INTEGRAL()
|
||||||
|
|
||||||
Returns the area under the curve for subsequent [field values](/influxdb/v2/reference/glossary/#field-value).
|
Returns the area under the curve for subsequent [field values](/influxdb/version/reference/glossary/#field-value).
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
`INTEGRAL()` does not support [`fill()`](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill). `INTEGRAL()` supports int64 and float64 field value [data types](/influxdb/v2/reference/glossary/#data-type).
|
`INTEGRAL()` does not support [`fill()`](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill). `INTEGRAL()` supports int64 and float64 field value [data types](/influxdb/version/reference/glossary/#data-type).
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
@ -200,24 +200,24 @@ SELECT INTEGRAL( [ * | <field_key> | /<regular_expression>/ ] [ , <unit> ] ) FR
|
||||||
```
|
```
|
||||||
|
|
||||||
InfluxDB calculates the area under the curve for subsequent field values and converts those results into the summed area per `unit`.
|
InfluxDB calculates the area under the curve for subsequent field values and converts those results into the summed area per `unit`.
|
||||||
The `unit` argument is an integer followed by an optional [duration literal](/influxdb/v2/reference/syntax/influxql/spec/#literals).
|
The `unit` argument is an integer followed by an optional [duration literal](/influxdb/version/reference/syntax/influxql/spec/#literals).
|
||||||
If the query does not specify the `unit`, the unit defaults to one second (`1s`).
|
If the query does not specify the `unit`, the unit defaults to one second (`1s`).
|
||||||
|
|
||||||
`INTEGRAL(field_key)`
|
`INTEGRAL(field_key)`
|
||||||
|
|
||||||
Returns the area under the curve for subsequent field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the area under the curve for subsequent field values associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`INTEGRAL(/regular_expression/)`
|
`INTEGRAL(/regular_expression/)`
|
||||||
|
|
||||||
Returns the area under the curve for subsequent field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/#regular-expressions).
|
Returns the area under the curve for subsequent field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/#regular-expressions).
|
||||||
|
|
||||||
`INTEGRAL(*)`
|
`INTEGRAL(*)`
|
||||||
|
|
||||||
Returns the average field value associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the average field value associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
The following examples use a subset of the [NOAA water sample data](/influxdb/v2/reference/sample-data/#noaa-water-sample-data) data:
|
The following examples use a subset of the [NOAA water sample data](/influxdb/version/reference/sample-data/#noaa-water-sample-data) data:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT "water_level" FROM "h2o_feet" WHERE "location" = 'santa_monica' AND time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:30:00Z'
|
SELECT "water_level" FROM "h2o_feet" WHERE "location" = 'santa_monica' AND time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:30:00Z'
|
||||||
|
@ -319,9 +319,9 @@ name: h2o_feet
|
||||||
|
|
||||||
Return the area under the curve (in minutes) for the field values associated
|
Return the area under the curve (in minutes) for the field values associated
|
||||||
with the `water_level` field key and in the `h2o_feet` measurement in the
|
with the `water_level` field key and in the `h2o_feet` measurement in the
|
||||||
[time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax) between
|
[time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax) between
|
||||||
`2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z`, [grouped](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals) results into 12-minute intervals, and
|
`2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z`, [grouped](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals) results into 12-minute intervals, and
|
||||||
[limit](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
[limit](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||||
the number of results returned to one.
|
the number of results returned to one.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
@ -341,7 +341,7 @@ name: h2o_feet
|
||||||
|
|
||||||
## MEAN()
|
## MEAN()
|
||||||
|
|
||||||
Returns the arithmetic mean (average) of [field values](/influxdb/v2/reference/glossary/#field-value). `MEAN()` supports int64 and float64 field value [data types](/influxdb/v2/reference/glossary/#data-type).
|
Returns the arithmetic mean (average) of [field values](/influxdb/version/reference/glossary/#field-value). `MEAN()` supports int64 and float64 field value [data types](/influxdb/version/reference/glossary/#data-type).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -350,14 +350,14 @@ SELECT MEAN( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE_c
|
||||||
```
|
```
|
||||||
|
|
||||||
`MEAN(field_key)`
|
`MEAN(field_key)`
|
||||||
Returns the average field value associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the average field value associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`MEAN(/regular_expression/)
|
`MEAN(/regular_expression/)
|
||||||
|
|
||||||
Returns the average field value associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/#regular-expressions).
|
Returns the average field value associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/#regular-expressions).
|
||||||
|
|
||||||
`MEAN(*)`
|
`MEAN(*)`
|
||||||
Returns the average field value associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the average field value associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -422,13 +422,13 @@ name: h2o_feet
|
||||||
{{% expand "Calculate the mean field value associated with a field key and include several clauses" %}}
|
{{% expand "Calculate the mean field value associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return the average of the values in the `water_level` field key in the
|
Return the average of the values in the `water_level` field key in the
|
||||||
[time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
[time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
||||||
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
||||||
[group](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
[group](/influxdb/version/query-data/influxql/explore-data/group-by/)
|
||||||
results into 12-minute time intervals and per tag.
|
results into 12-minute time intervals and per tag.
|
||||||
Then [fill](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
Then [fill](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
||||||
empty time intervals with `9.01` and
|
empty time intervals with `9.01` and
|
||||||
[limit](/influxdb/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
[limit](/influxdb/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||||
the number of points and series returned to seven and one.
|
the number of points and series returned to seven and one.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
@ -451,10 +451,10 @@ tags: location=coyote_creek
|
||||||
|
|
||||||
## MEDIAN()
|
## MEDIAN()
|
||||||
|
|
||||||
Returns the middle value from a sorted list of [field values](/influxdb/v2/reference/glossary/#field-value). `MEDIAN()` supports int64 and float64 field value [data types](/influxdb/v2/reference/glossary/#data-type).
|
Returns the middle value from a sorted list of [field values](/influxdb/version/reference/glossary/#field-value). `MEDIAN()` supports int64 and float64 field value [data types](/influxdb/version/reference/glossary/#data-type).
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** `MEDIAN()` is nearly equivalent to [`PERCENTILE(field_key, 50)`](/influxdb/v2/query-data/influxql/functions/selectors/#percentile), except `MEDIAN()` returns the average of the two middle field values if the field contains an even number of values.
|
**Note:** `MEDIAN()` is nearly equivalent to [`PERCENTILE(field_key, 50)`](/influxdb/version/query-data/influxql/functions/selectors/#percentile), except `MEDIAN()` returns the average of the two middle field values if the field contains an even number of values.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
@ -465,15 +465,15 @@ SELECT MEDIAN( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE
|
||||||
|
|
||||||
`MEDIAN(field_key)`
|
`MEDIAN(field_key)`
|
||||||
|
|
||||||
Returns the middle field value associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the middle field value associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`MEDIAN(/regular_expression/)`
|
`MEDIAN(/regular_expression/)`
|
||||||
|
|
||||||
Returns the middle field value associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/#regular-expressions).
|
Returns the middle field value associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/#regular-expressions).
|
||||||
|
|
||||||
`MEDIAN(*)`
|
`MEDIAN(*)`
|
||||||
|
|
||||||
Returns the middle field value associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the middle field value associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -537,13 +537,13 @@ name: h2o_feet
|
||||||
{{% expand "Calculate the median field value associated with a field key and include several clauses" %}}
|
{{% expand "Calculate the median field value associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return the middle field value in the `water_level` field key in the
|
Return the middle field value in the `water_level` field key in the
|
||||||
[time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
[time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
||||||
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
||||||
[group](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
[group](/influxdb/version/query-data/influxql/explore-data/group-by/)
|
||||||
results into 12-minute time intervals and per tag.
|
results into 12-minute time intervals and per tag.
|
||||||
Then [fill](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
Then [fill](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
||||||
empty time intervals with `700 `, [limit](/influxdb/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
empty time intervals with `700 `, [limit](/influxdb/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||||
the number of points and series returned to seven and one, and [offset](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/) the series returned by one.
|
the number of points and series returned to seven and one, and [offset](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/) the series returned by one.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT MEDIAN("water_level") FROM "h2o_feet" WHERE time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:30:00Z' GROUP BY time(12m),* fill(700) LIMIT 7 SLIMIT 1 SOFFSET 1
|
SELECT MEDIAN("water_level") FROM "h2o_feet" WHERE time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:30:00Z' GROUP BY time(12m),* fill(700) LIMIT 7 SLIMIT 1 SOFFSET 1
|
||||||
|
@ -565,10 +565,10 @@ tags: location=santa_monica
|
||||||
|
|
||||||
## MODE()
|
## MODE()
|
||||||
|
|
||||||
Returns the most frequent value in a list of [field values](/influxdb/v2/reference/glossary/#field-value). `MODE()` supports all field value [data types](/influxdb/v2/reference/glossary/#data-type).
|
Returns the most frequent value in a list of [field values](/influxdb/version/reference/glossary/#field-value). `MODE()` supports all field value [data types](/influxdb/version/reference/glossary/#data-type).
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** `MODE()` returns the field value with the earliest [timestamp](/influxdb/v2/reference/glossary/#timestamp) if there's a tie between two or more values for the maximum number of occurrences.
|
**Note:** `MODE()` returns the field value with the earliest [timestamp](/influxdb/version/reference/glossary/#timestamp) if there's a tie between two or more values for the maximum number of occurrences.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
@ -579,15 +579,15 @@ SELECT MODE( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE_c
|
||||||
|
|
||||||
`MODE(field_key)`
|
`MODE(field_key)`
|
||||||
|
|
||||||
Returns the most frequent field value associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the most frequent field value associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`MODE(/regular_expression/)`
|
`MODE(/regular_expression/)`
|
||||||
|
|
||||||
Returns the most frequent field value associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/#regular-expressions).
|
Returns the most frequent field value associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/#regular-expressions).
|
||||||
|
|
||||||
`MODE(*)`
|
`MODE(*)`
|
||||||
|
|
||||||
Returns the most frequent field value associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the most frequent field value associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -653,12 +653,12 @@ name: h2o_feet
|
||||||
{{% expand "Calculate the mode field value associated with a field key and include several clauses" %}}
|
{{% expand "Calculate the mode field value associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return the mode of the values associated with the `water_level` field key in the
|
Return the mode of the values associated with the `water_level` field key in the
|
||||||
[time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
[time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
||||||
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
||||||
[group](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
[group](/influxdb/version/query-data/influxql/explore-data/group-by/)
|
||||||
results into 12-minute time intervals and per tag.
|
results into 12-minute time intervals and per tag.
|
||||||
Then [limits](/influxdb/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
Then [limits](/influxdb/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||||
the number of points and series returned to three and one, and it [offsets](/influxdb/v2/query-data/influxql/explore-data
|
the number of points and series returned to three and one, and it [offsets](/influxdb/version/query-data/influxql/explore-data
|
||||||
#the-offset-and-soffset-clauses) the series returned by one.
|
#the-offset-and-soffset-clauses) the series returned by one.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
@ -681,7 +681,7 @@ tags: location=santa_monica
|
||||||
|
|
||||||
## SPREAD()
|
## SPREAD()
|
||||||
|
|
||||||
Returns the difference between the minimum and maximum [field values](/influxdb/v2/reference/glossary/#field-value). `SPREAD()` supports int64 and float64 field value [data types](/influxdb/v2/reference/glossary/#data-type).
|
Returns the difference between the minimum and maximum [field values](/influxdb/version/reference/glossary/#field-value). `SPREAD()` supports int64 and float64 field value [data types](/influxdb/version/reference/glossary/#data-type).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -691,15 +691,15 @@ SELECT SPREAD( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE
|
||||||
|
|
||||||
`SPREAD(field_key)`
|
`SPREAD(field_key)`
|
||||||
|
|
||||||
Returns the difference between the minimum and maximum field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the difference between the minimum and maximum field values associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`SPREAD(/regular_expression/)`
|
`SPREAD(/regular_expression/)`
|
||||||
|
|
||||||
Returns the difference between the minimum and maximum field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/#regular-expressions).
|
Returns the difference between the minimum and maximum field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/#regular-expressions).
|
||||||
|
|
||||||
`SPREAD(*)`
|
`SPREAD(*)`
|
||||||
|
|
||||||
Returns the difference between the minimum and maximum field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the difference between the minimum and maximum field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -766,14 +766,14 @@ name: h2o_feet
|
||||||
{{% expand "Calculate the spread for the field values associated with a field key and include several clauses" %}}
|
{{% expand "Calculate the spread for the field values associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return the difference between the minimum and maximum field values in the `water_level` field key in the
|
Return the difference between the minimum and maximum field values in the `water_level` field key in the
|
||||||
[time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
[time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
||||||
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
||||||
[group](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
[group](/influxdb/version/query-data/influxql/explore-data/group-by/)
|
||||||
results into 12-minute time intervals and per tag.
|
results into 12-minute time intervals and per tag.
|
||||||
Then [fill](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
Then [fill](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
||||||
empty time intervals with `18`, [lim
|
empty time intervals with `18`, [lim
|
||||||
ts](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
ts](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||||
the number of points and series returned to three and one, and [offsets](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/) the series returned by one.
|
the number of points and series returned to three and one, and [offsets](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/) the series returned by one.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT SPREAD("water_level") FROM "h2o_feet" WHERE time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:30:00Z' GROUP BY time(12m),* fill(18) LIMIT 3 SLIMIT 1 SOFFSET 1
|
SELECT SPREAD("water_level") FROM "h2o_feet" WHERE time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:30:00Z' GROUP BY time(12m),* fill(18) LIMIT 3 SLIMIT 1 SOFFSET 1
|
||||||
|
@ -795,7 +795,7 @@ tags: location=santa_monica
|
||||||
|
|
||||||
## STDDEV()
|
## STDDEV()
|
||||||
|
|
||||||
Returns the standard deviation of [field values](/influxdb/v2/reference/glossary/#field-value). `STDDEV()` supports int64 and float64 field value [data types](/influxdb/v2/reference/glossary/#data-type).
|
Returns the standard deviation of [field values](/influxdb/version/reference/glossary/#field-value). `STDDEV()` supports int64 and float64 field value [data types](/influxdb/version/reference/glossary/#data-type).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -805,15 +805,15 @@ SELECT STDDEV( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE
|
||||||
|
|
||||||
`STDDEV(field_key)`
|
`STDDEV(field_key)`
|
||||||
|
|
||||||
Returns the standard deviation of field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the standard deviation of field values associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`STDDEV(/regular_expression/)`
|
`STDDEV(/regular_expression/)`
|
||||||
|
|
||||||
Returns the standard deviation of field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/#regular-expressions).
|
Returns the standard deviation of field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/#regular-expressions).
|
||||||
|
|
||||||
`STDDEV(*)`
|
`STDDEV(*)`
|
||||||
|
|
||||||
Returns the standard deviation of field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the standard deviation of field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -877,13 +877,13 @@ name: h2o_feet
|
||||||
{{% expand "Calculate the standard deviation for the field values associated with a field key and include several clauses" %}}
|
{{% expand "Calculate the standard deviation for the field values associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return the standard deviation of the field values in the `water_level` field key in the
|
Return the standard deviation of the field values in the `water_level` field key in the
|
||||||
[time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
[time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
||||||
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
||||||
[group](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
[group](/influxdb/version/query-data/influxql/explore-data/group-by/)
|
||||||
results into 12-minute time intervals and per tag.
|
results into 12-minute time intervals and per tag.
|
||||||
Then [fill](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
Then [fill](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
||||||
empty time intervals with `18000`, [limit](/influxdb/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
empty time intervals with `18000`, [limit](/influxdb/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||||
the number of points and series returned to two and one, and [offsets](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/) the series returned by one.
|
the number of points and series returned to two and one, and [offsets](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/) the series returned by one.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT STDDEV("water_level") FROM "h2o_feet" WHERE time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:30:00Z' GROUP BY time(12m),* fill(18000) LIMIT 2 SLIMIT 1 SOFFSET 1
|
SELECT STDDEV("water_level") FROM "h2o_feet" WHERE time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:30:00Z' GROUP BY time(12m),* fill(18000) LIMIT 2 SLIMIT 1 SOFFSET 1
|
||||||
|
@ -904,7 +904,7 @@ tags: location=santa_monica
|
||||||
|
|
||||||
## SUM()
|
## SUM()
|
||||||
|
|
||||||
Returns the sum of [field values](/influxdb/v2/reference/glossary/#field-value). `SUM()` supports int64 and float64 field value [data types](/influxdb/v2/reference/glossary/#data-type).
|
Returns the sum of [field values](/influxdb/version/reference/glossary/#field-value). `SUM()` supports int64 and float64 field value [data types](/influxdb/version/reference/glossary/#data-type).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -914,15 +914,15 @@ SELECT SUM( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE_cl
|
||||||
|
|
||||||
`SUM(field_key)`
|
`SUM(field_key)`
|
||||||
|
|
||||||
Returns the sum of field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the sum of field values associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`SUM(/regular_expression/)`
|
`SUM(/regular_expression/)`
|
||||||
|
|
||||||
Returns the sum of field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/#regular-expressions).
|
Returns the sum of field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/#regular-expressions).
|
||||||
|
|
||||||
`SUM(*)`
|
`SUM(*)`
|
||||||
|
|
||||||
Returns the sums of field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the sums of field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -986,12 +986,12 @@ name: h2o_feet
|
||||||
{{% expand "Calculate the sum of the field values associated with a field key and include several clauses" %}}
|
{{% expand "Calculate the sum of the field values associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return the summed total of the field values in the `water_level` field key in the
|
Return the summed total of the field values in the `water_level` field key in the
|
||||||
[time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
[time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
||||||
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
||||||
[group](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
[group](/influxdb/version/query-data/influxql/explore-data/group-by/)
|
||||||
results into 12-minute time intervals and per tag.
|
results into 12-minute time intervals and per tag.
|
||||||
Then [fill](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
Then [fill](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
||||||
empty time intervals with 18000, and [limit](/influxdb/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
empty time intervals with 18000, and [limit](/influxdb/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||||
the number of points and series returned to four and one.
|
the number of points and series returned to four and one.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Use selector functions to assess, select, and return values in your data.
|
Use selector functions to assess, select, and return values in your data.
|
||||||
Selector functions return one or more rows with the selected values from each InfluxQL group.
|
Selector functions return one or more rows with the selected values from each InfluxQL group.
|
||||||
|
|
||||||
Each selector function below covers **syntax**, including parameters to pass to the function, and **examples** of how to use the function. Examples use [NOAA water sample data](/influxdb/v2/reference/sample-data/#noaa-water-sample-data).
|
Each selector function below covers **syntax**, including parameters to pass to the function, and **examples** of how to use the function. Examples use [NOAA water sample data](/influxdb/version/reference/sample-data/#noaa-water-sample-data).
|
||||||
|
|
||||||
- [BOTTOM()](#bottom)
|
- [BOTTOM()](#bottom)
|
||||||
- [FIRST()](#first)
|
- [FIRST()](#first)
|
||||||
|
@ -15,7 +15,7 @@ Each selector function below covers **syntax**, including parameters to pass to
|
||||||
|
|
||||||
## BOTTOM()
|
## BOTTOM()
|
||||||
|
|
||||||
Returns the smallest `N` [field values](/influxdb/v2/reference/glossary/#field-value). `BOTTOM()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
Returns the smallest `N` [field values](/influxdb/version/reference/glossary/#field-value). `BOTTOM()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** `BOTTOM()` returns the field value with the earliest timestamp if there's a tie between two or more values for the smallest value.
|
**Note:** `BOTTOM()` returns the field value with the earliest timestamp if there's a tie between two or more values for the smallest value.
|
||||||
|
@ -28,13 +28,13 @@ SELECT BOTTOM(<field_key>[,<tag_key(s)>],<N> )[,<tag_key(s)>|<field_key(s)>] FRO
|
||||||
```
|
```
|
||||||
|
|
||||||
`BOTTOM(field_key,N)`
|
`BOTTOM(field_key,N)`
|
||||||
Returns the smallest N field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the smallest N field values associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`BOTTOM(field_key,tag_key,N)`
|
`BOTTOM(field_key,tag_key,N)`
|
||||||
Returns the smallest field value for N tag values of the [tag key](/influxdb/v2/reference/glossary/#tag-key). Add a comma between multiple tag keys: `tag_key,tag_key`.
|
Returns the smallest field value for N tag values of the [tag key](/influxdb/version/reference/glossary/#tag-key). Add a comma between multiple tag keys: `tag_key,tag_key`.
|
||||||
|
|
||||||
`BOTTOM((field_key,N),tag_key,field_key)`
|
`BOTTOM((field_key,N),tag_key,field_key)`
|
||||||
Returns the smallest N field values associated with the field key in the parentheses and the relevant [tag](/influxdb/v2/reference/glossary/#tag) and/or [field](/influxdb/v2/reference/glossary/#field). Add a comma between multiple tag or field keys: `tag_key,tag_key,field_key,field_key`.
|
Returns the smallest N field values associated with the field key in the parentheses and the relevant [tag](/influxdb/version/reference/glossary/#tag) and/or [field](/influxdb/version/reference/glossary/#field). Add a comma between multiple tag or field keys: `tag_key,tag_key,field_key,field_key`.
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ Returns the smallest N field values associated with the field key in the parenth
|
||||||
{{% expand "Select the bottom three field values associated with a field key" %}}
|
{{% expand "Select the bottom three field values associated with a field key" %}}
|
||||||
|
|
||||||
Return the smallest three field values in the `water_level` field key and in the
|
Return the smallest three field values in the `water_level` field key and in the
|
||||||
`h2o_feet` [measurement](/influxdb/v2/reference/glossary/#measurement).
|
`h2o_feet` [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT BOTTOM("water_level",3) FROM "h2o_feet"
|
SELECT BOTTOM("water_level",3) FROM "h2o_feet"
|
||||||
|
@ -105,9 +105,9 @@ name: h2o_feet
|
||||||
{{% expand "Select the bottom three field values associated with a field key and include several clauses" %}}
|
{{% expand "Select the bottom three field values associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return the smallest three values in the `water_level` field key for each 24-minute
|
Return the smallest three values in the `water_level` field key for each 24-minute
|
||||||
[interval](/influxdb/v2/query-data/influxql/explore-data/group-by/#basic-group-by-time-syntax)
|
[interval](/influxdb/version/query-data/influxql/explore-data/group-by/#basic-group-by-time-syntax)
|
||||||
between `2019-08-18T00:00:00Z` and `2019-08-18T00:54:00Z` with results in
|
between `2019-08-18T00:00:00Z` and `2019-08-18T00:54:00Z` with results in
|
||||||
[descending timestamp](/influxdb/v2/query-data/influxql/explore-data/order-by/) order.
|
[descending timestamp](/influxdb/version/query-data/influxql/explore-data/order-by/) order.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT BOTTOM("water_level",3),"location" FROM "h2o_feet" WHERE time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:54:00Z' GROUP BY time(24m) ORDER BY time DESC
|
SELECT BOTTOM("water_level",3),"location" FROM "h2o_feet" WHERE time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:54:00Z' GROUP BY time(24m) ORDER BY time DESC
|
||||||
|
@ -129,7 +129,7 @@ name: h2o_feet
|
||||||
| 2019-08-18T00:12:00Z | 2.343 | santa_monica |
|
| 2019-08-18T00:12:00Z | 2.343 | santa_monica |
|
||||||
| 2019-08-18T00:00:00Z | 2.352 | santa_monica |
|
| 2019-08-18T00:00:00Z | 2.352 | santa_monica |
|
||||||
|
|
||||||
Notice that the [GROUP BY time() clause](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals)
|
Notice that the [GROUP BY time() clause](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals)
|
||||||
does not override the points’ original timestamps.
|
does not override the points’ original timestamps.
|
||||||
See [Issue 1](#bottom-with-a-group-by-time-clause) in the section below for a
|
See [Issue 1](#bottom-with-a-group-by-time-clause) in the section below for a
|
||||||
more detailed explanation of that behavior.
|
more detailed explanation of that behavior.
|
||||||
|
@ -144,7 +144,7 @@ more detailed explanation of that behavior.
|
||||||
|
|
||||||
Queries with `BOTTOM()` and a `GROUP BY time()` clause return the specified
|
Queries with `BOTTOM()` and a `GROUP BY time()` clause return the specified
|
||||||
number of points per `GROUP BY time()` interval.
|
number of points per `GROUP BY time()` interval.
|
||||||
For [most `GROUP BY time()` queries](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals),
|
For [most `GROUP BY time()` queries](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals),
|
||||||
the returned timestamps mark the start of the `GROUP BY time()` interval.
|
the returned timestamps mark the start of the `GROUP BY time()` interval.
|
||||||
`GROUP BY time()` queries with the `BOTTOM()` function behave differently;
|
`GROUP BY time()` queries with the `BOTTOM()` function behave differently;
|
||||||
they maintain the timestamp of the original data point.
|
they maintain the timestamp of the original data point.
|
||||||
|
@ -199,7 +199,7 @@ name: h2o_feet
|
||||||
|
|
||||||
## FIRST()
|
## FIRST()
|
||||||
|
|
||||||
Returns the [field value ](/influxdb/v2/reference/glossary/#field-value) with the oldest timestamp.
|
Returns the [field value ](/influxdb/version/reference/glossary/#field-value) with the oldest timestamp.
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -211,15 +211,15 @@ SELECT FIRST(<field_key>)[,<tag_key(s)>|<field_key(s)>] FROM_clause [WHERE_claus
|
||||||
Returns the oldest field value (determined by timestamp) associated with the field key.
|
Returns the oldest field value (determined by timestamp) associated with the field key.
|
||||||
|
|
||||||
`FIRST(/regular_expression/)`
|
`FIRST(/regular_expression/)`
|
||||||
Returns the oldest field value (determined by timestamp) associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
Returns the oldest field value (determined by timestamp) associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||||
|
|
||||||
`FIRST(*)`
|
`FIRST(*)`
|
||||||
Returns the oldest field value (determined by timestamp) associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the oldest field value (determined by timestamp) associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
`FIRST(field_key),tag_key(s),field_key(s)`
|
`FIRST(field_key),tag_key(s),field_key(s)`
|
||||||
Returns the oldest field value (determined by timestamp) associated with the field key in the parentheses and the relevant [tag](/influxdb/v2/reference/glossary/#tag) and/or [field](/influxdb/v2/reference/glossary/#field).
|
Returns the oldest field value (determined by timestamp) associated with the field key in the parentheses and the relevant [tag](/influxdb/version/reference/glossary/#tag) and/or [field](/influxdb/version/reference/glossary/#field).
|
||||||
|
|
||||||
`FIRST()` supports all field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`FIRST()` supports all field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -303,12 +303,12 @@ name: h2o_feet
|
||||||
{{% expand "Select the first field value associated with a field key and include several clauses" %}}
|
{{% expand "Select the first field value associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Returns the oldest field value (determined by timestamp) in the `water_level`
|
Returns the oldest field value (determined by timestamp) in the `water_level`
|
||||||
field key in the [time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
field key in the [time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
||||||
between `2019-08-17T23:48:00Z` and `2019-08-18T00:54:00Z` and
|
between `2019-08-17T23:48:00Z` and `2019-08-18T00:54:00Z` and
|
||||||
[groups](/influxdb/v2/query-data/influxql/explore-data/group-by/) results into
|
[groups](/influxdb/version/query-data/influxql/explore-data/group-by/) results into
|
||||||
12-minute time intervals and per tag.
|
12-minute time intervals and per tag.
|
||||||
Then [fill](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
Then [fill](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
||||||
empty time intervals with `9.01`, and it [limit](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
empty time intervals with `9.01`, and it [limit](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||||
the number of points and series returned to four and one.
|
the number of points and series returned to four and one.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
@ -327,7 +327,7 @@ tags: location=coyote_creek
|
||||||
| 2019-08-18T00:12:00Z | 8.320 |
|
| 2019-08-18T00:12:00Z | 8.320 |
|
||||||
| 2019-08-18T00:24:00Z | 8.130 |
|
| 2019-08-18T00:24:00Z | 8.130 |
|
||||||
|
|
||||||
Notice that the [`GROUP BY time()` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals) overrides the points' original timestamps.
|
Notice that the [`GROUP BY time()` clause](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals) overrides the points' original timestamps.
|
||||||
The timestamps in the results indicate the the start of each 12-minute time interval;
|
The timestamps in the results indicate the the start of each 12-minute time interval;
|
||||||
the first point in the results covers the time interval between `2019-08-17T23:48:00Z` and just before `2019-08-18T00:00:00Z` and the last point in the results covers the time interval between `2019-08-18T00:24:00Z` and just before `2019-08-18T00:36:00Z`.
|
the first point in the results covers the time interval between `2019-08-17T23:48:00Z` and just before `2019-08-18T00:00:00Z` and the last point in the results covers the time interval between `2019-08-18T00:24:00Z` and just before `2019-08-18T00:36:00Z`.
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ the first point in the results covers the time interval between `2019-08-17T23:4
|
||||||
|
|
||||||
## LAST()
|
## LAST()
|
||||||
|
|
||||||
Returns the [field value](/influxdb/v2/reference/glossary/#field-value) with the most recent timestamp.
|
Returns the [field value](/influxdb/version/reference/glossary/#field-value) with the most recent timestamp.
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -346,18 +346,18 @@ SELECT LAST(<field_key>)[,<tag_key(s)>|<field_keys(s)>] FROM_clause [WHERE_claus
|
||||||
```
|
```
|
||||||
|
|
||||||
`LAST(field_key)`
|
`LAST(field_key)`
|
||||||
Returns the newest field value (determined by timestamp) associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the newest field value (determined by timestamp) associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`LAST(/regular_expression/)`
|
`LAST(/regular_expression/)`
|
||||||
Returns the newest field value (determined by timestamp) associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
Returns the newest field value (determined by timestamp) associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||||
|
|
||||||
`LAST(*)`
|
`LAST(*)`
|
||||||
Returns the newest field value (determined by timestamp) associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the newest field value (determined by timestamp) associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
`LAST(field_key),tag_key(s),field_key(s)`
|
`LAST(field_key),tag_key(s),field_key(s)`
|
||||||
Returns the newest field value (determined by timestamp) associated with the field key in the parentheses and the relevant [tag](/influxdb/v2/reference/glossary/#tag) and/or [field](/influxdb/v2/reference/glossary/#field).
|
Returns the newest field value (determined by timestamp) associated with the field key in the parentheses and the relevant [tag](/influxdb/version/reference/glossary/#tag) and/or [field](/influxdb/version/reference/glossary/#field).
|
||||||
|
|
||||||
`LAST()` supports all field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`LAST()` supports all field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -442,12 +442,12 @@ name: h2o_feet
|
||||||
{{% expand "Select the last field value associated with a field key and include several clauses" %}}
|
{{% expand "Select the last field value associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return the newest field value (determined by timestamp) in the `water_level`
|
Return the newest field value (determined by timestamp) in the `water_level`
|
||||||
field key in the [time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
field key in the [time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
||||||
between `2019-08-17T23:48:00Z` and `2019-08-18T00:54:00Z` and
|
between `2019-08-17T23:48:00Z` and `2019-08-18T00:54:00Z` and
|
||||||
[groups](/influxdb/v2/query-data/influxql/explore-data/group-by/) results into
|
[groups](/influxdb/version/query-data/influxql/explore-data/group-by/) results into
|
||||||
12-minute time intervals and per tag.
|
12-minute time intervals and per tag.
|
||||||
Then [fill](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
Then [fill](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
||||||
empty time intervals with `9.01`, and it [limit](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
empty time intervals with `9.01`, and it [limit](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||||
the number of points and series returned to four and one.
|
the number of points and series returned to four and one.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
@ -466,7 +466,7 @@ tags: location=coyote_creek
|
||||||
| 2019-08-18T00:12:00Z | 8.225 |
|
| 2019-08-18T00:12:00Z | 8.225 |
|
||||||
| 2019-08-18T00:24:00Z | 8.012 |
|
| 2019-08-18T00:24:00Z | 8.012 |
|
||||||
|
|
||||||
Notice that the [`GROUP BY time()` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals) overrides the points' original timestamps.
|
Notice that the [`GROUP BY time()` clause](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals) overrides the points' original timestamps.
|
||||||
The timestamps in the results indicate the the start of each 12-minute time interval;
|
The timestamps in the results indicate the the start of each 12-minute time interval;
|
||||||
the first point in the results covers the time interval between `2019-08-17T23:48:00Z` and just before `2019-08-18T00:00:00Z` and the last point in the results covers the time interval between `2019-08-18T00:24:00Z` and just before `2019-08-18T00:36:00Z`.
|
the first point in the results covers the time interval between `2019-08-17T23:48:00Z` and just before `2019-08-18T00:00:00Z` and the last point in the results covers the time interval between `2019-08-18T00:24:00Z` and just before `2019-08-18T00:36:00Z`.
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ the first point in the results covers the time interval between `2019-08-17T23:4
|
||||||
|
|
||||||
## MAX()
|
## MAX()
|
||||||
|
|
||||||
Returns the greatest [field value](/influxdb/v2/reference/glossary/#field-value).
|
Returns the greatest [field value](/influxdb/version/reference/glossary/#field-value).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -485,18 +485,18 @@ SELECT MAX(<field_key>)[,<tag_key(s)>|<field__key(s)>] FROM_clause [WHERE_clause
|
||||||
```
|
```
|
||||||
|
|
||||||
`MAX(field_key)`
|
`MAX(field_key)`
|
||||||
Returns the greatest field value associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the greatest field value associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`MAX(/regular_expression/)`
|
`MAX(/regular_expression/)`
|
||||||
Returns the greatest field value associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
Returns the greatest field value associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||||
|
|
||||||
`MAX(*)`
|
`MAX(*)`
|
||||||
Returns the greatest field value associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the greatest field value associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
`MAX(field_key),tag_key(s),field_key(s)`
|
`MAX(field_key),tag_key(s),field_key(s)`
|
||||||
Returns the greatest field value associated with the field key in the parentheses and the relevant [tag](/influxdb/v2/reference/glossary/#tag) and/or [field](/influxdb/v2/reference/glossary/#field).
|
Returns the greatest field value associated with the field key in the parentheses and the relevant [tag](/influxdb/version/reference/glossary/#tag) and/or [field](/influxdb/version/reference/glossary/#field).
|
||||||
|
|
||||||
`MAX()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`MAX()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -581,12 +581,12 @@ name: h2o_feet
|
||||||
{{% expand "Select the maximum field value associated with a field key and include several clauses" %}}
|
{{% expand "Select the maximum field value associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return the greatest field value in the `water_level` field key in the
|
Return the greatest field value in the `water_level` field key in the
|
||||||
[time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
[time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
||||||
between `2019-08-17T23:48:00Z` and `2019-08-18T00:54:00Z` and
|
between `2019-08-17T23:48:00Z` and `2019-08-18T00:54:00Z` and
|
||||||
[groups](/influxdb/v2/query-data/influxql/explore-data/group-by/) results into
|
[groups](/influxdb/version/query-data/influxql/explore-data/group-by/) results into
|
||||||
12-minute time intervals and per tag.
|
12-minute time intervals and per tag.
|
||||||
Then [fill](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
Then [fill](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
||||||
empty time intervals with `9.01`, and it [limit](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
empty time intervals with `9.01`, and it [limit](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||||
the number of points and series returned to four and one.
|
the number of points and series returned to four and one.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
@ -605,7 +605,7 @@ tags: location=coyote_creek
|
||||||
| 2019-08-18T00:12:00Z | 8.320 |
|
| 2019-08-18T00:12:00Z | 8.320 |
|
||||||
| 2019-08-18T00:24:00Z | 8.130 |
|
| 2019-08-18T00:24:00Z | 8.130 |
|
||||||
|
|
||||||
Notice that the [`GROUP BY time()` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals) overrides the points’ original timestamps.
|
Notice that the [`GROUP BY time()` clause](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals) overrides the points’ original timestamps.
|
||||||
The timestamps in the results indicate the the start of each 12-minute time interval;
|
The timestamps in the results indicate the the start of each 12-minute time interval;
|
||||||
the first point in the results covers the time interval between `2019-08-17T23:48:00Z` and just before `2019-08-18T00:00:00Z` and the last point in the results covers the time interval between `2019-08-18T00:24:00Z` and just before `2019-08-18T00:36:00Z`.
|
the first point in the results covers the time interval between `2019-08-17T23:48:00Z` and just before `2019-08-18T00:00:00Z` and the last point in the results covers the time interval between `2019-08-18T00:24:00Z` and just before `2019-08-18T00:36:00Z`.
|
||||||
|
|
||||||
|
@ -615,7 +615,7 @@ the first point in the results covers the time interval between `2019-08-17T23:4
|
||||||
|
|
||||||
## MIN()
|
## MIN()
|
||||||
|
|
||||||
Returns the lowest [field value](/influxdb/v2/reference/glossary/#field-value).
|
Returns the lowest [field value](/influxdb/version/reference/glossary/#field-value).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -624,18 +624,18 @@ SELECT MIN(<field_key>)[,<tag_key(s)>|<field_key(s)>] FROM_clause [WHERE_clause]
|
||||||
```
|
```
|
||||||
|
|
||||||
`MIN(field_key)`
|
`MIN(field_key)`
|
||||||
Returns the lowest field value associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the lowest field value associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`MIN(/regular_expression/)`
|
`MIN(/regular_expression/)`
|
||||||
Returns the lowest field value associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
Returns the lowest field value associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||||
|
|
||||||
`MIN(*)`
|
`MIN(*)`
|
||||||
Returns the lowest field value associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the lowest field value associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
`MIN(field_key),tag_key(s),field_key(s)`
|
`MIN(field_key),tag_key(s),field_key(s)`
|
||||||
Returns the lowest field value associated with the field key in the parentheses and the relevant [tag](/influxdb/v2/reference/glossary/#tag) and/or [field](/influxdb/v2/reference/glossary/#field).
|
Returns the lowest field value associated with the field key in the parentheses and the relevant [tag](/influxdb/version/reference/glossary/#tag) and/or [field](/influxdb/version/reference/glossary/#field).
|
||||||
|
|
||||||
`MIN()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`MIN()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -719,12 +719,12 @@ name: h2o_feet
|
||||||
{{% expand "Select the minimum field value associated with a field key and include several clauses" %}}
|
{{% expand "Select the minimum field value associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return the lowest field value in the `water_level` field key in the
|
Return the lowest field value in the `water_level` field key in the
|
||||||
[time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
[time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
||||||
between `2019-08-17T23:48:00Z` and `2019-08-18T00:54:00Z` and
|
between `2019-08-17T23:48:00Z` and `2019-08-18T00:54:00Z` and
|
||||||
[groups](/influxdb/v2/query-data/influxql/explore-data/group-by/) results into
|
[groups](/influxdb/version/query-data/influxql/explore-data/group-by/) results into
|
||||||
12-minute time intervals and per tag.
|
12-minute time intervals and per tag.
|
||||||
Then [fill](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
Then [fill](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
||||||
empty time intervals with `9.01`, and it [limit](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
empty time intervals with `9.01`, and it [limit](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||||
the number of points and series returned to four and one.
|
the number of points and series returned to four and one.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
@ -743,7 +743,7 @@ tags: location=coyote_creek
|
||||||
| 2019-08-18T00:12:00Z | 8.225 |
|
| 2019-08-18T00:12:00Z | 8.225 |
|
||||||
| 2019-08-18T00:24:00Z | 8.012 |
|
| 2019-08-18T00:24:00Z | 8.012 |
|
||||||
|
|
||||||
Notice that the [`GROUP BY time()` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals) overrides the points’ original timestamps.
|
Notice that the [`GROUP BY time()` clause](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals) overrides the points’ original timestamps.
|
||||||
The timestamps in the results indicate the the start of each 12-minute time interval;
|
The timestamps in the results indicate the the start of each 12-minute time interval;
|
||||||
the first point in the results covers the time interval between `2019-08-17T23:48:00Z` and just before `2019-08-18T00:00:00Z` and the last point in the results covers the time interval between `2019-08-18T00:24:00Z` and just before `2019-08-18T00:36:00Z`.
|
the first point in the results covers the time interval between `2019-08-17T23:48:00Z` and just before `2019-08-18T00:00:00Z` and the last point in the results covers the time interval between `2019-08-18T00:24:00Z` and just before `2019-08-18T00:36:00Z`.
|
||||||
|
|
||||||
|
@ -753,7 +753,7 @@ the first point in the results covers the time interval between `2019-08-17T23:4
|
||||||
|
|
||||||
## PERCENTILE()
|
## PERCENTILE()
|
||||||
|
|
||||||
Returns the `N`th percentile [field value](/influxdb/v2/reference/glossary/#field-value).
|
Returns the `N`th percentile [field value](/influxdb/version/reference/glossary/#field-value).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -762,19 +762,19 @@ SELECT PERCENTILE(<field_key>, <N>)[,<tag_key(s)>|<field_key(s)>] FROM_clause [W
|
||||||
```
|
```
|
||||||
|
|
||||||
`PERCENTILE(field_key,N)`
|
`PERCENTILE(field_key,N)`
|
||||||
Returns the Nth percentile field value associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the Nth percentile field value associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`PERCENTILE(/regular_expression/,N)`
|
`PERCENTILE(/regular_expression/,N)`
|
||||||
Returns the Nth percentile field value associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
Returns the Nth percentile field value associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||||
|
|
||||||
`PERCENTILE(*,N)`
|
`PERCENTILE(*,N)`
|
||||||
Returns the Nth percentile field value associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns the Nth percentile field value associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
`PERCENTILE(field_key,N),tag_key(s),field_key(s)`
|
`PERCENTILE(field_key,N),tag_key(s),field_key(s)`
|
||||||
Returns the Nth percentile field value associated with the field key in the parentheses and the relevant [tag](/influxdb/v2/reference/glossary/#tag) and/or [field](/influxdb/v2/reference/glossary/#field).
|
Returns the Nth percentile field value associated with the field key in the parentheses and the relevant [tag](/influxdb/version/reference/glossary/#tag) and/or [field](/influxdb/version/reference/glossary/#field).
|
||||||
|
|
||||||
`N` must be an integer or floating point number between `0` and `100`, inclusive.
|
`N` must be an integer or floating point number between `0` and `100`, inclusive.
|
||||||
`PERCENTILE()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`PERCENTILE()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -861,10 +861,10 @@ name: h2o_feet
|
||||||
{{% expand "Select the twentieth percentile field value associated with a field key and include several clauses" %}}
|
{{% expand "Select the twentieth percentile field value associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return the field value that is larger than 20 percent of the values in the
|
Return the field value that is larger than 20 percent of the values in the
|
||||||
`water_level` field in the [time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
`water_level` field in the [time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
||||||
between `2019-08-17T23:48:00Z` and `2019-08-18T00:54:00Z` and [group](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals) results into 24-minute intervals.
|
between `2019-08-17T23:48:00Z` and `2019-08-18T00:54:00Z` and [group](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals) results into 24-minute intervals.
|
||||||
Then [fill](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
Then [fill](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals-and-fill)
|
||||||
empty time intervals with `15` and [limit](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
empty time intervals with `15` and [limit](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||||
the number of points returned to two.
|
the number of points returned to two.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
@ -880,7 +880,7 @@ name: h2o_feet
|
||||||
| 2019-08-17T23:36:00Z | 2.398 |
|
| 2019-08-17T23:36:00Z | 2.398 |
|
||||||
| 2019-08-18T00:00:00Z | 2.343 |
|
| 2019-08-18T00:00:00Z | 2.343 |
|
||||||
|
|
||||||
Notice that the [`GROUP BY time()` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals) overrides the points’ original timestamps.
|
Notice that the [`GROUP BY time()` clause](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals) overrides the points’ original timestamps.
|
||||||
The timestamps in the results indicate the the start of each 24-minute time interval; the first point in the results covers the time interval between `2019-08-17T23:36:00Z` and just before `2019-08-18T00:00:00Z` and the last point in the results covers the time interval between `2019-08-18T00:00:00Z` and just before `2019-08-18T00:24:00Z`.
|
The timestamps in the results indicate the the start of each 24-minute time interval; the first point in the results covers the time interval between `2019-08-17T23:36:00Z` and just before `2019-08-18T00:00:00Z` and the last point in the results covers the time interval between `2019-08-18T00:00:00Z` and just before `2019-08-18T00:24:00Z`.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
@ -892,12 +892,12 @@ The timestamps in the results indicate the the start of each 24-minute time inte
|
||||||
#### PERCENTILE() compared to other InfluxQL functions
|
#### PERCENTILE() compared to other InfluxQL functions
|
||||||
|
|
||||||
- `PERCENTILE(<field_key>,100)` is equivalent to [`MAX(<field_key>)`](#max).
|
- `PERCENTILE(<field_key>,100)` is equivalent to [`MAX(<field_key>)`](#max).
|
||||||
- `PERCENTILE(<field_key>, 50)` is nearly equivalent to [`MEDIAN(<field_key>)`](/influxdb/v2/query-data/influxql/functions/aggregates/#median), except the `MEDIAN()` function returns the average of the two middle values if the field key contains an even number of field values.
|
- `PERCENTILE(<field_key>, 50)` is nearly equivalent to [`MEDIAN(<field_key>)`](/influxdb/version/query-data/influxql/functions/aggregates/#median), except the `MEDIAN()` function returns the average of the two middle values if the field key contains an even number of field values.
|
||||||
- `PERCENTILE(<field_key>,0)` is not equivalent to [`MIN(<field_key>)`](#min). This is a known [issue](https://github.com/influxdata/influxdb/issues/4418).
|
- `PERCENTILE(<field_key>,0)` is not equivalent to [`MIN(<field_key>)`](#min). This is a known [issue](https://github.com/influxdata/influxdb/issues/4418).
|
||||||
|
|
||||||
## SAMPLE()
|
## SAMPLE()
|
||||||
|
|
||||||
Returns a random sample of `N` [field values](/influxdb/v2/reference/glossary/#field-value).
|
Returns a random sample of `N` [field values](/influxdb/version/reference/glossary/#field-value).
|
||||||
`SAMPLE()` uses [reservoir sampling](https://en.wikipedia.org/wiki/Reservoir_sampling) to generate the random points.
|
`SAMPLE()` uses [reservoir sampling](https://en.wikipedia.org/wiki/Reservoir_sampling) to generate the random points.
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
@ -907,19 +907,19 @@ SELECT SAMPLE(<field_key>, <N>)[,<tag_key(s)>|<field_key(s)>] FROM_clause [WHERE
|
||||||
```
|
```
|
||||||
|
|
||||||
`SAMPLE(field_key,N)`
|
`SAMPLE(field_key,N)`
|
||||||
Returns N randomly selected field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns N randomly selected field values associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`SAMPLE(/regular_expression/,N)`
|
`SAMPLE(/regular_expression/,N)`
|
||||||
Returns N randomly selected field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
Returns N randomly selected field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||||
|
|
||||||
`SAMPLE(*,N)`
|
`SAMPLE(*,N)`
|
||||||
Returns N randomly selected field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement).
|
Returns N randomly selected field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
`SAMPLE(field_key,N),tag_key(s),field_key(s)`
|
`SAMPLE(field_key,N),tag_key(s),field_key(s)`
|
||||||
Returns N randomly selected field values associated with the field key in the parentheses and the relevant [tag](/influxdb/v2/reference/glossary/#tag) and/or [field](/influxdb/v2/reference/glossary/#field).
|
Returns N randomly selected field values associated with the field key in the parentheses and the relevant [tag](/influxdb/version/reference/glossary/#tag) and/or [field](/influxdb/version/reference/glossary/#field).
|
||||||
|
|
||||||
`N` must be an integer.
|
`N` must be an integer.
|
||||||
`SAMPLE()` supports all field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`SAMPLE()` supports all field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
|
@ -1011,9 +1011,9 @@ name: h2o_feet
|
||||||
{{% expand "Select a sample of the field values associated with a field key and include several clauses" %}}
|
{{% expand "Select a sample of the field values associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return one randomly selected point from the `water_level` field key in the
|
Return one randomly selected point from the `water_level` field key in the
|
||||||
[time range](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
[time range](/influxdb/version/query-data/influxql/explore-data/time-and-timezone/#time-syntax)
|
||||||
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
between `2019-08-18T00:00:00Z` and `2019-08-18T00:30:00Z` and
|
||||||
[group](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals)
|
[group](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals)
|
||||||
results into 18-minute intervals.
|
results into 18-minute intervals.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
@ -1029,7 +1029,7 @@ name: h2o_feet
|
||||||
| 2019-08-18T00:12:00Z | 2.343 |
|
| 2019-08-18T00:12:00Z | 2.343 |
|
||||||
| 2019-08-18T00:24:00Z | 2.264 |
|
| 2019-08-18T00:24:00Z | 2.264 |
|
||||||
|
|
||||||
Notice that the [`GROUP BY time()` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals) does not override the points' original timestamps.
|
Notice that the [`GROUP BY time()` clause](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals) does not override the points' original timestamps.
|
||||||
See [Issue 1](#sample-with-a-group-by-time-clause) in the section below for a
|
See [Issue 1](#sample-with-a-group-by-time-clause) in the section below for a
|
||||||
more detailed explanation of that behavior.
|
more detailed explanation of that behavior.
|
||||||
|
|
||||||
|
@ -1043,7 +1043,7 @@ more detailed explanation of that behavior.
|
||||||
|
|
||||||
Queries with `SAMPLE()` and a `GROUP BY time()` clause return the specified
|
Queries with `SAMPLE()` and a `GROUP BY time()` clause return the specified
|
||||||
number of points (`N`) per `GROUP BY time()` interval.
|
number of points (`N`) per `GROUP BY time()` interval.
|
||||||
For [most `GROUP BY time()` queries](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals),
|
For [most `GROUP BY time()` queries](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals),
|
||||||
the returned timestamps mark the start of the `GROUP BY time()` interval.
|
the returned timestamps mark the start of the `GROUP BY time()` interval.
|
||||||
`GROUP BY time()` queries with the `SAMPLE()` function behave differently;
|
`GROUP BY time()` queries with the `SAMPLE()` function behave differently;
|
||||||
they maintain the timestamp of the original data point.
|
they maintain the timestamp of the original data point.
|
||||||
|
@ -1075,7 +1075,7 @@ interval and the last two rows are randomly-selected points from the second time
|
||||||
|
|
||||||
## TOP()
|
## TOP()
|
||||||
|
|
||||||
Returns the greatest `N` [field values](/influxdb/v2/reference/glossary/#field-value).
|
Returns the greatest `N` [field values](/influxdb/version/reference/glossary/#field-value).
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -1084,15 +1084,15 @@ SELECT TOP( <field_key>[,<tag_key(s)>],<N> )[,<tag_key(s)>|<field_key(s)>] FROM_
|
||||||
```
|
```
|
||||||
|
|
||||||
`TOP(field_key,N)`
|
`TOP(field_key,N)`
|
||||||
Returns the greatest N field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key).
|
Returns the greatest N field values associated with the [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
`TOP(field_key,tag_key(s),N)`
|
`TOP(field_key,tag_key(s),N)`
|
||||||
Returns the greatest field value for N tag values of the [tag key](/influxdb/v2/reference/glossary/#tag-key).
|
Returns the greatest field value for N tag values of the [tag key](/influxdb/version/reference/glossary/#tag-key).
|
||||||
|
|
||||||
`TOP(field_key,N),tag_key(s),field_key(s)`
|
`TOP(field_key,N),tag_key(s),field_key(s)`
|
||||||
Returns the greatest N field values associated with the field key in the parentheses and the relevant [tag](/influxdb/v2/reference/glossary/#tag) and/or [field](/influxdb/v2/reference/glossary/#field).
|
Returns the greatest N field values associated with the field key in the parentheses and the relevant [tag](/influxdb/version/reference/glossary/#tag) and/or [field](/influxdb/version/reference/glossary/#field).
|
||||||
|
|
||||||
`TOP()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`TOP()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** `TOP()` returns the field value with the earliest timestamp if there's a tie between two or more values for the greatest value.
|
**Note:** `TOP()` returns the field value with the earliest timestamp if there's a tie between two or more values for the greatest value.
|
||||||
|
@ -1105,7 +1105,7 @@ Returns the greatest N field values associated with the field key in the parenth
|
||||||
{{% expand "Select the top three field values associated with a field key" %}}
|
{{% expand "Select the top three field values associated with a field key" %}}
|
||||||
|
|
||||||
Return the greatest three field values in the `water_level` field key and in the
|
Return the greatest three field values in the `water_level` field key and in the
|
||||||
`h2o_feet` [measurement](/influxdb/v2/reference/glossary/#measurement).
|
`h2o_feet` [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT TOP("water_level",3) FROM "h2o_feet"
|
SELECT TOP("water_level",3) FROM "h2o_feet"
|
||||||
|
@ -1168,9 +1168,9 @@ name: h2o_feet
|
||||||
{{% expand "Select the top three field values associated with a field key and include several clauses" %}}
|
{{% expand "Select the top three field values associated with a field key and include several clauses" %}}
|
||||||
|
|
||||||
Return the greatest three values in the `water_level` field key for each 24-minute
|
Return the greatest three values in the `water_level` field key for each 24-minute
|
||||||
[interval](/influxdb/v2/query-data/influxql/explore-data/group-by/#basic-group-by-time-syntax)
|
[interval](/influxdb/version/query-data/influxql/explore-data/group-by/#basic-group-by-time-syntax)
|
||||||
between `2019-08-18T00:00:00Z` and `2019-08-18T00:54:00Z` with results in
|
between `2019-08-18T00:00:00Z` and `2019-08-18T00:54:00Z` with results in
|
||||||
[descending timestamp](/influxdb/v2/query-data/influxql/explore-data/order-by/) order.
|
[descending timestamp](/influxdb/version/query-data/influxql/explore-data/order-by/) order.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT TOP("water_level",3),"location" FROM "h2o_feet" WHERE time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:54:00Z' GROUP BY time(24m) ORDER BY time DESC
|
SELECT TOP("water_level",3),"location" FROM "h2o_feet" WHERE time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:54:00Z' GROUP BY time(24m) ORDER BY time DESC
|
||||||
|
@ -1192,7 +1192,7 @@ name: h2o_feet
|
||||||
| 2019-08-18T00:06:00Z | 8.005 | coyote_creek |
|
| 2019-08-18T00:06:00Z | 8.005 | coyote_creek |
|
||||||
| 2019-08-18T00:00:00Z | 8.120 | coyote_creek |
|
| 2019-08-18T00:00:00Z | 8.120 | coyote_creek |
|
||||||
|
|
||||||
Notice that the [GROUP BY time() clause](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals) does not override the points’ original timestamps.
|
Notice that the [GROUP BY time() clause](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals) does not override the points’ original timestamps.
|
||||||
See [Issue 1](#top-with-a-group-by-time-clause) in the section below for a more detailed explanation of that behavior.
|
See [Issue 1](#top-with-a-group-by-time-clause) in the section below for a more detailed explanation of that behavior.
|
||||||
|
|
||||||
{{% /expand %}}
|
{{% /expand %}}
|
||||||
|
@ -1205,7 +1205,7 @@ See [Issue 1](#top-with-a-group-by-time-clause) in the section below for a more
|
||||||
|
|
||||||
Queries with `TOP()` and a `GROUP BY time()` clause return the specified
|
Queries with `TOP()` and a `GROUP BY time()` clause return the specified
|
||||||
number of points per `GROUP BY time()` interval.
|
number of points per `GROUP BY time()` interval.
|
||||||
For [most `GROUP BY time()` queries](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals),
|
For [most `GROUP BY time()` queries](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals),
|
||||||
the returned timestamps mark the start of the `GROUP BY time()` interval.
|
the returned timestamps mark the start of the `GROUP BY time()` interval.
|
||||||
`GROUP BY time()` queries with the `TOP()` function behave differently;
|
`GROUP BY time()` queries with the `TOP()` function behave differently;
|
||||||
they maintain the timestamp of the original data point.
|
they maintain the timestamp of the original data point.
|
||||||
|
@ -1261,7 +1261,7 @@ name: h2o_feet
|
||||||
<!--
|
<!--
|
||||||
##### TOP(), tags, and the INTO clause
|
##### TOP(), tags, and the INTO clause
|
||||||
|
|
||||||
When combined with an [`INTO` clause](/enterprise_influxdb/v1/query_language/explore-data/#the-into-clause) and no [`GROUP BY tag` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-tags), most InfluxQL functions [convert](/enterprise_influxdb/v1/troubleshooting/frequently-asked-questions/#why-are-my-into-queries-missing-data) any tags in the initial data to fields in the newly written data.
|
When combined with an [`INTO` clause](/enterprise_influxdb/v1/query_language/explore-data/#the-into-clause) and no [`GROUP BY tag` clause](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-tags), most InfluxQL functions [convert](/enterprise_influxdb/v1/troubleshooting/frequently-asked-questions/#why-are-my-into-queries-missing-data) any tags in the initial data to fields in the newly written data.
|
||||||
This behavior also applies to the `TOP()` function unless `TOP()` includes a tag key as an argument: `TOP(field_key,tag_key(s),N)`.
|
This behavior also applies to the `TOP()` function unless `TOP()` includes a tag key as an argument: `TOP(field_key,tag_key(s),N)`.
|
||||||
In those cases, the system preserves the specified tag as a tag in the newly written data.
|
In those cases, the system preserves the specified tag as a tag in the newly written data.
|
||||||
|
|
||||||
|
@ -1270,7 +1270,7 @@ In those cases, the system preserves the specified tag as a tag in the newly wri
|
||||||
The first query in the codeblock below returns the greatest field values in the `water_level` field key for two tag values associated with the `location` tag key.
|
The first query in the codeblock below returns the greatest field values in the `water_level` field key for two tag values associated with the `location` tag key.
|
||||||
It also writes those results to the `top_water_levels` measurement.
|
It also writes those results to the `top_water_levels` measurement.
|
||||||
|
|
||||||
The second query [shows](/influxdb/v2/query-data/influxql/explore-schema/#show-tag-keys) that InfluxDB preserved the `location` tag as a tag in the `top_water_levels` measurement.
|
The second query [shows](/influxdb/version/query-data/influxql/explore-schema/#show-tag-keys) that InfluxDB preserved the `location` tag as a tag in the `top_water_levels` measurement.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT TOP("water_level","location",2) INTO "top_water_levels" FROM "h2o_feet"
|
SELECT TOP("water_level","location",2) INTO "top_water_levels" FROM "h2o_feet"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Use technical analysis functions to apply algorithms to your data--often used to analyze financial and investment data.
|
Use technical analysis functions to apply algorithms to your data--often used to analyze financial and investment data.
|
||||||
|
|
||||||
Each analysis function below covers **syntax**, including parameters to pass to the function, and **examples** of how to use the function. Examples use [NOAA water sample data](/influxdb/v2/reference/sample-data/#noaa-water-sample-data).
|
Each analysis function below covers **syntax**, including parameters to pass to the function, and **examples** of how to use the function. Examples use [NOAA water sample data](/influxdb/version/reference/sample-data/#noaa-water-sample-data).
|
||||||
|
|
||||||
- [Predictive analysis](#predictive-analysis):
|
- [Predictive analysis](#predictive-analysis):
|
||||||
- [HOLT_WINTERS()](#holt_winters)
|
- [HOLT_WINTERS()](#holt_winters)
|
||||||
|
@ -22,9 +22,9 @@ predict and forecast future values.
|
||||||
|
|
||||||
### HOLT_WINTERS()
|
### HOLT_WINTERS()
|
||||||
|
|
||||||
Returns N number of predicted [field values](/influxdb/v2/reference/glossary/#field-value)
|
Returns N number of predicted [field values](/influxdb/version/reference/glossary/#field-value)
|
||||||
using the [Holt-Winters](https://www.otexts.org/fpp/7/5) seasonal method.
|
using the [Holt-Winters](https://www.otexts.org/fpp/7/5) seasonal method.
|
||||||
Supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
Supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
Works with data that occurs at consistent time intervals.
|
Works with data that occurs at consistent time intervals.
|
||||||
Requires an InfluxQL function and the `GROUP BY time()` clause to ensure that
|
Requires an InfluxQL function and the `GROUP BY time()` clause to ensure that
|
||||||
the Holt-Winters function operates on regular data.
|
the Holt-Winters function operates on regular data.
|
||||||
|
@ -41,9 +41,9 @@ SELECT HOLT_WINTERS[_WITH-FIT](<function>(<field_key>),<N>,<S>) FROM_clause [WHE
|
||||||
```
|
```
|
||||||
|
|
||||||
`HOLT_WINTERS(function(field_key),N,S)` returns `N` seasonally adjusted
|
`HOLT_WINTERS(function(field_key),N,S)` returns `N` seasonally adjusted
|
||||||
predicted field values for the specified [field key](/influxdb/v2/reference/glossary/#field-key).
|
predicted field values for the specified [field key](/influxdb/version/reference/glossary/#field-key).
|
||||||
|
|
||||||
The `N` predicted values occur at the same interval as the [`GROUP BY time()` interval](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
The `N` predicted values occur at the same interval as the [`GROUP BY time()` interval](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
||||||
If your `GROUP BY time()` interval is `6m` and `N` is `3` you'll
|
If your `GROUP BY time()` interval is `6m` and `N` is `3` you'll
|
||||||
receive three predicted values that are each six minutes apart.
|
receive three predicted values that are each six minutes apart.
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ addition to `N` seasonally adjusted predicted field values for the specified fie
|
||||||
|
|
||||||
##### Sample data
|
##### Sample data
|
||||||
|
|
||||||
The examples use the following subset of the [NOAA water sample data](/influxdb/v2/reference/sample-data/#noaa-water-sample-data):
|
The examples use the following subset of the [NOAA water sample data](/influxdb/version/reference/sample-data/#noaa-water-sample-data):
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT "water_level" FROM "noaa"."autogen"."h2o_feet" WHERE "location"='santa_monica' AND time >= '2019-08-17T00:00:00Z' AND time <= '2019-08-22T00:00:00Z'
|
SELECT "water_level" FROM "noaa"."autogen"."h2o_feet" WHERE "location"='santa_monica' AND time >= '2019-08-17T00:00:00Z' AND time <= '2019-08-22T00:00:00Z'
|
||||||
|
@ -73,7 +73,7 @@ SELECT "water_level" FROM "noaa"."autogen"."h2o_feet" WHERE "location"='santa_mo
|
||||||
##### Step 1: Match the trends of the raw data
|
##### Step 1: Match the trends of the raw data
|
||||||
|
|
||||||
Write a `GROUP BY time()` query that matches the general trends of the raw `water_level` data.
|
Write a `GROUP BY time()` query that matches the general trends of the raw `water_level` data.
|
||||||
Here, we use the [`FIRST()`](/influxdb/v2/query-data/influxql/functions/selectors/#first) function:
|
Here, we use the [`FIRST()`](/influxdb/version/query-data/influxql/functions/selectors/#first) function:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT FIRST("water_level") FROM "noaa"."autogen"."h2o_feet" WHERE "location"='santa_monica' and time >= '2019-08-17T00:00:00Z' AND time <= '2019-08-22T00:00:00Z' GROUP BY time(6h,6h)
|
SELECT FIRST("water_level") FROM "noaa"."autogen"."h2o_feet" WHERE "location"='santa_monica' and time >= '2019-08-17T00:00:00Z' AND time <= '2019-08-22T00:00:00Z' GROUP BY time(6h,6h)
|
||||||
|
@ -82,7 +82,7 @@ SELECT FIRST("water_level") FROM "noaa"."autogen"."h2o_feet" WHERE "location"='s
|
||||||
In the `GROUP BY time()` clause, the first argument (`6h`) matches
|
In the `GROUP BY time()` clause, the first argument (`6h`) matches
|
||||||
the length of time that occurs between each peak and trough in the `water_level` data.
|
the length of time that occurs between each peak and trough in the `water_level` data.
|
||||||
The second argument (`6h`) is the
|
The second argument (`6h`) is the
|
||||||
[offset interval](/influxdb/v2/query-data/influxql/explore-data/group-by/#advanced-group-by-time-syntax).
|
[offset interval](/influxdb/version/query-data/influxql/explore-data/group-by/#advanced-group-by-time-syntax).
|
||||||
The offset interval alters the default `GROUP BY time()` boundaries to
|
The offset interval alters the default `GROUP BY time()` boundaries to
|
||||||
match the time range of the raw data.
|
match the time range of the raw data.
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ then dividing the result by the sum of all data movement over a given time perio
|
||||||
The result is multiplied by 100 to give the -100 to +100 range.
|
The result is multiplied by 100 to give the -100 to +100 range.
|
||||||
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/cmo" target="\_blank">Source</a>
|
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/cmo" target="\_blank">Source</a>
|
||||||
|
|
||||||
Supports `GROUP BY` clauses that [group by tags](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals). To use `CHANDE_MOMENTUM_OSCILLATOR()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/v2/query-data/influxql/functions/transformations/#advanced-syntax).
|
Supports `GROUP BY` clauses that [group by tags](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals). To use `CHANDE_MOMENTUM_OSCILLATOR()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||||
|
|
||||||
### Basic syntax
|
### Basic syntax
|
||||||
|
|
||||||
|
@ -231,46 +231,46 @@ CHANDE_MOMENTUM_OSCILLATOR([ * | <field_key> | /regular_expression/ ], <period>[
|
||||||
- (Optional) [warmup_type](#warmup_type)
|
- (Optional) [warmup_type](#warmup_type)
|
||||||
|
|
||||||
`CHANDE_MOMENTUM_OSCILLATOR(field_key, 2)`
|
`CHANDE_MOMENTUM_OSCILLATOR(field_key, 2)`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Chande Momentum Oscillator algorithm with a 2-value period
|
processed using the Chande Momentum Oscillator algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`CHANDE_MOMENTUM_OSCILLATOR(field_key, 10, 9, 'none')`
|
`CHANDE_MOMENTUM_OSCILLATOR(field_key, 10, 9, 'none')`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Chande Momentum Oscillator algorithm with a 10-value period
|
processed using the Chande Momentum Oscillator algorithm with a 10-value period
|
||||||
a 9-value hold period, and the `none` warmup type.
|
a 9-value hold period, and the `none` warmup type.
|
||||||
|
|
||||||
`CHANDE_MOMENTUM_OSCILLATOR(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
`CHANDE_MOMENTUM_OSCILLATOR(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
||||||
Returns the mean of field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the mean of field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Chande Momentum Oscillator algorithm with a 2-value period
|
processed using the Chande Momentum Oscillator algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/v2/query-data/influxql/functions/aggregates/) in your call to the `CHANDE_MOMENTUM_OSCILLATOR()` function.
|
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/version/query-data/influxql/functions/aggregates/) in your call to the `CHANDE_MOMENTUM_OSCILLATOR()` function.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
`CHANDE_MOMENTUM_OSCILLATOR(/regular_expression/, 2)`
|
`CHANDE_MOMENTUM_OSCILLATOR(/regular_expression/, 2)`
|
||||||
Returns the field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)
|
Returns the field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/)
|
||||||
processed using the Chande Momentum Oscillator algorithm with a 2-value period
|
processed using the Chande Momentum Oscillator algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`CHANDE_MOMENTUM_OSCILLATOR(*, 2)`
|
`CHANDE_MOMENTUM_OSCILLATOR(*, 2)`
|
||||||
Returns the field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement)
|
Returns the field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement)
|
||||||
processed using the Chande Momentum Oscillator algorithm with a 2-value period
|
processed using the Chande Momentum Oscillator algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`CHANDE_MOMENTUM_OSCILLATOR()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`CHANDE_MOMENTUM_OSCILLATOR()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
## EXPONENTIAL_MOVING_AVERAGE()
|
## EXPONENTIAL_MOVING_AVERAGE()
|
||||||
|
|
||||||
An exponential moving average (EMA) (or exponentially weighted moving average) is a type of moving average similar to a [simple moving average](/influxdb/v2/query-data/influxql/functions/transformations/#moving_average),
|
An exponential moving average (EMA) (or exponentially weighted moving average) is a type of moving average similar to a [simple moving average](/influxdb/version/query-data/influxql/functions/transformations/#moving_average),
|
||||||
except more weight is given to the latest data.
|
except more weight is given to the latest data.
|
||||||
|
|
||||||
This type of moving average reacts faster to recent data changes than a simple moving average.
|
This type of moving average reacts faster to recent data changes than a simple moving average.
|
||||||
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="https://www.investopedia.com/terms/e/ema.asp" target="\_blank">Source</a>
|
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="https://www.investopedia.com/terms/e/ema.asp" target="\_blank">Source</a>
|
||||||
|
|
||||||
Supports `GROUP BY` clauses that [group by tags](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
Supports `GROUP BY` clauses that [group by tags](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
||||||
To use `EXPONENTIAL_MOVING_AVERAGE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/v2/query-data/influxql/functions/transformations/#advanced-syntax).
|
To use `EXPONENTIAL_MOVING_AVERAGE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||||
|
|
||||||
### Basic syntax
|
### Basic syntax
|
||||||
|
|
||||||
|
@ -279,35 +279,35 @@ EXPONENTIAL_MOVING_AVERAGE([ * | <field_key> | /regular_expression/ ], <period>[
|
||||||
```
|
```
|
||||||
|
|
||||||
`EXPONENTIAL_MOVING_AVERAGE(field_key, 2)`
|
`EXPONENTIAL_MOVING_AVERAGE(field_key, 2)`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Exponential Moving Average algorithm with a 2-value period
|
processed using the Exponential Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`EXPONENTIAL_MOVING_AVERAGE(field_key, 10, 9, 'exponential')`
|
`EXPONENTIAL_MOVING_AVERAGE(field_key, 10, 9, 'exponential')`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Exponential Moving Average algorithm with a 10-value period
|
processed using the Exponential Moving Average algorithm with a 10-value period
|
||||||
a 9-value hold period, and the `exponential` warmup type.
|
a 9-value hold period, and the `exponential` warmup type.
|
||||||
|
|
||||||
`EXPONENTIAL_MOVING_AVERAGE(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
`EXPONENTIAL_MOVING_AVERAGE(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
||||||
Returns the mean of field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the mean of field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Exponential Moving Average algorithm with a 2-value period
|
processed using the Exponential Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/v2/query-data/influxql/functions/aggregates/) in your call to the `EXPONENTIAL_MOVING_AVERAGE()` function.
|
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/version/query-data/influxql/functions/aggregates/) in your call to the `EXPONENTIAL_MOVING_AVERAGE()` function.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
`EXPONENTIAL_MOVING_AVERAGE(/regular_expression/, 2)`
|
`EXPONENTIAL_MOVING_AVERAGE(/regular_expression/, 2)`
|
||||||
Returns the field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)
|
Returns the field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/)
|
||||||
processed using the Exponential Moving Average algorithm with a 2-value period
|
processed using the Exponential Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`EXPONENTIAL_MOVING_AVERAGE(*, 2)`
|
`EXPONENTIAL_MOVING_AVERAGE(*, 2)`
|
||||||
Returns the field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement)
|
Returns the field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement)
|
||||||
processed using the Exponential Moving Average algorithm with a 2-value period
|
processed using the Exponential Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`EXPONENTIAL_MOVING_AVERAGE()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`EXPONENTIAL_MOVING_AVERAGE()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
### Arguments
|
### Arguments
|
||||||
|
|
||||||
|
@ -325,8 +325,8 @@ To keep the value in line with the actual data and to remove the lag, the value
|
||||||
is subtracted from the previously doubled EMA.
|
is subtracted from the previously doubled EMA.
|
||||||
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="https://en.wikipedia.org/wiki/Double_exponential_moving_average" target="\_blank">Source</a>
|
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="https://en.wikipedia.org/wiki/Double_exponential_moving_average" target="\_blank">Source</a>
|
||||||
|
|
||||||
Supports `GROUP BY` clauses that [group by tags](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
Supports `GROUP BY` clauses that [group by tags](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
||||||
To use `DOUBLE_EXPONENTIAL_MOVING_AVERAGE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/v2/query-data/influxql/functions/transformations/#advanced-syntax).
|
To use `DOUBLE_EXPONENTIAL_MOVING_AVERAGE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||||
|
|
||||||
### Basic syntax
|
### Basic syntax
|
||||||
|
|
||||||
|
@ -335,35 +335,35 @@ DOUBLE_EXPONENTIAL_MOVING_AVERAGE([ * | <field_key> | /regular_expression/ ], <p
|
||||||
```
|
```
|
||||||
|
|
||||||
`DOUBLE_EXPONENTIAL_MOVING_AVERAGE(field_key, 2)`
|
`DOUBLE_EXPONENTIAL_MOVING_AVERAGE(field_key, 2)`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Double Exponential Moving Average algorithm with a 2-value period
|
processed using the Double Exponential Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`DOUBLE_EXPONENTIAL_MOVING_AVERAGE(field_key, 10, 9, 'exponential')`
|
`DOUBLE_EXPONENTIAL_MOVING_AVERAGE(field_key, 10, 9, 'exponential')`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Double Exponential Moving Average algorithm with a 10-value period
|
processed using the Double Exponential Moving Average algorithm with a 10-value period
|
||||||
a 9-value hold period, and the `exponential` warmup type.
|
a 9-value hold period, and the `exponential` warmup type.
|
||||||
|
|
||||||
`DOUBLE_EXPONENTIAL_MOVING_AVERAGE(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
`DOUBLE_EXPONENTIAL_MOVING_AVERAGE(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
||||||
Returns the mean of field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the mean of field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Double Exponential Moving Average algorithm with a 2-value period
|
processed using the Double Exponential Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/v2/query-data/influxql/functions/aggregates/) in your call to the `DOUBLE_EXPONENTIAL_MOVING_AVERAGE()` function.
|
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/version/query-data/influxql/functions/aggregates/) in your call to the `DOUBLE_EXPONENTIAL_MOVING_AVERAGE()` function.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
`DOUBLE_EXPONENTIAL_MOVING_AVERAGE(/regular_expression/, 2)`
|
`DOUBLE_EXPONENTIAL_MOVING_AVERAGE(/regular_expression/, 2)`
|
||||||
Returns the field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)
|
Returns the field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/)
|
||||||
processed using the Double Exponential Moving Average algorithm with a 2-value period
|
processed using the Double Exponential Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`DOUBLE_EXPONENTIAL_MOVING_AVERAGE(*, 2)`
|
`DOUBLE_EXPONENTIAL_MOVING_AVERAGE(*, 2)`
|
||||||
Returns the field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement)
|
Returns the field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement)
|
||||||
processed using the Double Exponential Moving Average algorithm with a 2-value period
|
processed using the Double Exponential Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`DOUBLE_EXPONENTIAL_MOVING_AVERAGE()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`DOUBLE_EXPONENTIAL_MOVING_AVERAGE()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
### Arguments
|
### Arguments
|
||||||
|
|
||||||
|
@ -383,8 +383,8 @@ The ER is very similar to the [Chande Momentum Oscillator](#chande_momentum_osci
|
||||||
The difference is that the CMO takes market direction into account, but if you take the absolute CMO and divide by 100, you you get the Efficiency Ratio.
|
The difference is that the CMO takes market direction into account, but if you take the absolute CMO and divide by 100, you you get the Efficiency Ratio.
|
||||||
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="http://etfhq.com/blog/2011/02/07/kaufmans-efficiency-ratio/" target="\_blank">Source</a>
|
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="http://etfhq.com/blog/2011/02/07/kaufmans-efficiency-ratio/" target="\_blank">Source</a>
|
||||||
|
|
||||||
Supports `GROUP BY` clauses that [group by tags](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
Supports `GROUP BY` clauses that [group by tags](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
||||||
To use `KAUFMANS_EFFICIENCY_RATIO()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/v2/query-data/influxql/functions/transformations/#advanced-syntax).
|
To use `KAUFMANS_EFFICIENCY_RATIO()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||||
|
|
||||||
### Basic syntax
|
### Basic syntax
|
||||||
|
|
||||||
|
@ -393,35 +393,35 @@ KAUFMANS_EFFICIENCY_RATIO([ * | <field_key> | /regular_expression/ ], <period>[,
|
||||||
```
|
```
|
||||||
|
|
||||||
`KAUFMANS_EFFICIENCY_RATIO(field_key, 2)`
|
`KAUFMANS_EFFICIENCY_RATIO(field_key, 2)`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Efficiency Index algorithm with a 2-value period
|
processed using the Efficiency Index algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`KAUFMANS_EFFICIENCY_RATIO(field_key, 10, 10)`
|
`KAUFMANS_EFFICIENCY_RATIO(field_key, 10, 10)`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Efficiency Index algorithm with a 10-value period and
|
processed using the Efficiency Index algorithm with a 10-value period and
|
||||||
a 10-value hold period.
|
a 10-value hold period.
|
||||||
|
|
||||||
`KAUFMANS_EFFICIENCY_RATIO(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
`KAUFMANS_EFFICIENCY_RATIO(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
||||||
Returns the mean of field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the mean of field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Efficiency Index algorithm with a 2-value period
|
processed using the Efficiency Index algorithm with a 2-value period
|
||||||
and the default hold period.
|
and the default hold period.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/v2/query-data/influxql/functions/aggregates/) in your call to the `KAUFMANS_EFFICIENCY_RATIO()` function.
|
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/version/query-data/influxql/functions/aggregates/) in your call to the `KAUFMANS_EFFICIENCY_RATIO()` function.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
`KAUFMANS_EFFICIENCY_RATIO(/regular_expression/, 2)`
|
`KAUFMANS_EFFICIENCY_RATIO(/regular_expression/, 2)`
|
||||||
Returns the field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)
|
Returns the field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/)
|
||||||
processed using the Efficiency Index algorithm with a 2-value period
|
processed using the Efficiency Index algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`KAUFMANS_EFFICIENCY_RATIO(*, 2)`
|
`KAUFMANS_EFFICIENCY_RATIO(*, 2)`
|
||||||
Returns the field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement)
|
Returns the field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement)
|
||||||
processed using the Efficiency Index algorithm with a 2-value period
|
processed using the Efficiency Index algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`KAUFMANS_EFFICIENCY_RATIO()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`KAUFMANS_EFFICIENCY_RATIO()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
**Arguments:**
|
**Arguments:**
|
||||||
|
|
||||||
|
@ -438,8 +438,8 @@ This trend-following indicator can be used to identify the overall trend,
|
||||||
time turning points and filter data movements.
|
time turning points and filter data movements.
|
||||||
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:kaufman_s_adaptive_moving_average" target="\_blank">Source</a>
|
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:kaufman_s_adaptive_moving_average" target="\_blank">Source</a>
|
||||||
|
|
||||||
Supports `GROUP BY` clauses that [group by tags](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
Supports `GROUP BY` clauses that [group by tags](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
||||||
To use `KAUFMANS_ADAPTIVE_MOVING_AVERAGE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/v2/query-data/influxql/functions/transformations/#advanced-syntax).
|
To use `KAUFMANS_ADAPTIVE_MOVING_AVERAGE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||||
|
|
||||||
### Basic syntax
|
### Basic syntax
|
||||||
|
|
||||||
|
@ -448,35 +448,35 @@ KAUFMANS_ADAPTIVE_MOVING_AVERAGE([ * | <field_key> | /regular_expression/ ], <pe
|
||||||
```
|
```
|
||||||
|
|
||||||
`KAUFMANS_ADAPTIVE_MOVING_AVERAGE(field_key, 2)`
|
`KAUFMANS_ADAPTIVE_MOVING_AVERAGE(field_key, 2)`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Kaufman Adaptive Moving Average algorithm with a 2-value period
|
processed using the Kaufman Adaptive Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`KAUFMANS_ADAPTIVE_MOVING_AVERAGE(field_key, 10, 10)`
|
`KAUFMANS_ADAPTIVE_MOVING_AVERAGE(field_key, 10, 10)`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Kaufman Adaptive Moving Average algorithm with a 10-value period
|
processed using the Kaufman Adaptive Moving Average algorithm with a 10-value period
|
||||||
and a 10-value hold period.
|
and a 10-value hold period.
|
||||||
|
|
||||||
`KAUFMANS_ADAPTIVE_MOVING_AVERAGE(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
`KAUFMANS_ADAPTIVE_MOVING_AVERAGE(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
||||||
Returns the mean of field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the mean of field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Kaufman Adaptive Moving Average algorithm with a 2-value period
|
processed using the Kaufman Adaptive Moving Average algorithm with a 2-value period
|
||||||
and the default hold period.
|
and the default hold period.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/v2/query-data/influxql/functions/aggregates/) in your call to the `KAUFMANS_ADAPTIVE_MOVING_AVERAGE()` function.
|
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/version/query-data/influxql/functions/aggregates/) in your call to the `KAUFMANS_ADAPTIVE_MOVING_AVERAGE()` function.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
`KAUFMANS_ADAPTIVE_MOVING_AVERAGE(/regular_expression/, 2)`
|
`KAUFMANS_ADAPTIVE_MOVING_AVERAGE(/regular_expression/, 2)`
|
||||||
Returns the field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)
|
Returns the field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/)
|
||||||
processed using the Kaufman Adaptive Moving Average algorithm with a 2-value period
|
processed using the Kaufman Adaptive Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`KAUFMANS_ADAPTIVE_MOVING_AVERAGE(*, 2)`
|
`KAUFMANS_ADAPTIVE_MOVING_AVERAGE(*, 2)`
|
||||||
Returns the field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement)
|
Returns the field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement)
|
||||||
processed using the Kaufman Adaptive Moving Average algorithm with a 2-value period
|
processed using the Kaufman Adaptive Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`KAUFMANS_ADAPTIVE_MOVING_AVERAGE()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`KAUFMANS_ADAPTIVE_MOVING_AVERAGE()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
**Arguments:**
|
**Arguments:**
|
||||||
- [period](#period)
|
- [period](#period)
|
||||||
|
@ -492,8 +492,8 @@ a [double exponential moving average](#double_exponential_moving_average),
|
||||||
and a triple exponential moving average.
|
and a triple exponential moving average.
|
||||||
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="https://www.investopedia.com/terms/t/triple-exponential-moving-average.asp " target="\_blank">Source</a>
|
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="https://www.investopedia.com/terms/t/triple-exponential-moving-average.asp " target="\_blank">Source</a>
|
||||||
|
|
||||||
Supports `GROUP BY` clauses that [group by tags](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
Supports `GROUP BY` clauses that [group by tags](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
||||||
To use `TRIPLE_EXPONENTIAL_MOVING_AVERAGE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/v2/query-data/influxql/functions/transformations/#advanced-syntax).
|
To use `TRIPLE_EXPONENTIAL_MOVING_AVERAGE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||||
|
|
||||||
### Basic syntax
|
### Basic syntax
|
||||||
|
|
||||||
|
@ -502,35 +502,35 @@ TRIPLE_EXPONENTIAL_MOVING_AVERAGE([ * | <field_key> | /regular_expression/ ], <p
|
||||||
```
|
```
|
||||||
|
|
||||||
`TRIPLE_EXPONENTIAL_MOVING_AVERAGE(field_key, 2)`
|
`TRIPLE_EXPONENTIAL_MOVING_AVERAGE(field_key, 2)`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Triple Exponential Moving Average algorithm with a 2-value period
|
processed using the Triple Exponential Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`TRIPLE_EXPONENTIAL_MOVING_AVERAGE(field_key, 10, 9, 'exponential')`
|
`TRIPLE_EXPONENTIAL_MOVING_AVERAGE(field_key, 10, 9, 'exponential')`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Triple Exponential Moving Average algorithm with a 10-value period
|
processed using the Triple Exponential Moving Average algorithm with a 10-value period
|
||||||
a 9-value hold period, and the `exponential` warmup type.
|
a 9-value hold period, and the `exponential` warmup type.
|
||||||
|
|
||||||
`TRIPLE_EXPONENTIAL_MOVING_AVERAGE(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
`TRIPLE_EXPONENTIAL_MOVING_AVERAGE(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
||||||
Returns the mean of field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the mean of field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Triple Exponential Moving Average algorithm with a 2-value period
|
processed using the Triple Exponential Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/v2/query-data/influxql/functions/aggregates/) in your call to the `TRIPLE_EXPONENTIAL_MOVING_AVERAGE()` function.
|
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/version/query-data/influxql/functions/aggregates/) in your call to the `TRIPLE_EXPONENTIAL_MOVING_AVERAGE()` function.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
`TRIPLE_EXPONENTIAL_MOVING_AVERAGE(/regular_expression/, 2)`
|
`TRIPLE_EXPONENTIAL_MOVING_AVERAGE(/regular_expression/, 2)`
|
||||||
Returns the field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)
|
Returns the field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/)
|
||||||
processed using the Triple Exponential Moving Average algorithm with a 2-value period
|
processed using the Triple Exponential Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`TRIPLE_EXPONENTIAL_MOVING_AVERAGE(*, 2)`
|
`TRIPLE_EXPONENTIAL_MOVING_AVERAGE(*, 2)`
|
||||||
Returns the field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement)
|
Returns the field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement)
|
||||||
processed using the Triple Exponential Moving Average algorithm with a 2-value period
|
processed using the Triple Exponential Moving Average algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`TRIPLE_EXPONENTIAL_MOVING_AVERAGE()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`TRIPLE_EXPONENTIAL_MOVING_AVERAGE()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
**Arguments:**
|
**Arguments:**
|
||||||
- [period](#period)
|
- [period](#period)
|
||||||
|
@ -543,7 +543,7 @@ The triple exponential derivative indicator, commonly referred to as "TRIX," is
|
||||||
an oscillator used to identify oversold and overbought markets, and can also be
|
an oscillator used to identify oversold and overbought markets, and can also be
|
||||||
used as a momentum indicator.
|
used as a momentum indicator.
|
||||||
TRIX calculates a [triple exponential moving average](#triple_exponential_moving_average)
|
TRIX calculates a [triple exponential moving average](#triple_exponential_moving_average)
|
||||||
of the [log](/influxdb/v2/query-data/influxql/functions/transformations/#log)
|
of the [log](/influxdb/version/query-data/influxql/functions/transformations/#log)
|
||||||
of the data input over the period of time.
|
of the data input over the period of time.
|
||||||
The previous value is subtracted from the previous value.
|
The previous value is subtracted from the previous value.
|
||||||
This prevents cycles that are shorter than the defined period from being considered by the indicator.
|
This prevents cycles that are shorter than the defined period from being considered by the indicator.
|
||||||
|
@ -556,8 +556,8 @@ Many analysts believe that when the TRIX crosses above the zero line it gives a
|
||||||
buy signal, and when it closes below the zero line, it gives a sell signal.
|
buy signal, and when it closes below the zero line, it gives a sell signal.
|
||||||
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="https://www.investopedia.com/articles/technical/02/092402.asp " target="\_blank">Source</a>
|
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="https://www.investopedia.com/articles/technical/02/092402.asp " target="\_blank">Source</a>
|
||||||
|
|
||||||
Supports `GROUP BY` clauses that [group by tags](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
Supports `GROUP BY` clauses that [group by tags](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
||||||
To use `TRIPLE_EXPONENTIAL_DERIVATIVE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/v2/query-data/influxql/functions/transformations/#advanced-syntax).
|
To use `TRIPLE_EXPONENTIAL_DERIVATIVE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||||
|
|
||||||
### Basic syntax
|
### Basic syntax
|
||||||
|
|
||||||
|
@ -566,44 +566,44 @@ TRIPLE_EXPONENTIAL_DERIVATIVE([ * | <field_key> | /regular_expression/ ], <perio
|
||||||
```
|
```
|
||||||
|
|
||||||
`TRIPLE_EXPONENTIAL_DERIVATIVE(field_key, 2)`
|
`TRIPLE_EXPONENTIAL_DERIVATIVE(field_key, 2)`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Triple Exponential Derivative algorithm with a 2-value period
|
processed using the Triple Exponential Derivative algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`TRIPLE_EXPONENTIAL_DERIVATIVE(field_key, 10, 10, 'exponential')`
|
`TRIPLE_EXPONENTIAL_DERIVATIVE(field_key, 10, 10, 'exponential')`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Triple Exponential Derivative algorithm with a 10-value period,
|
processed using the Triple Exponential Derivative algorithm with a 10-value period,
|
||||||
a 10-value hold period, and the `exponential` warmup type.
|
a 10-value hold period, and the `exponential` warmup type.
|
||||||
|
|
||||||
`TRIPLE_EXPONENTIAL_DERIVATIVE(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
`TRIPLE_EXPONENTIAL_DERIVATIVE(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
||||||
Returns the mean of field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the mean of field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Triple Exponential Derivative algorithm with a 2-value period
|
processed using the Triple Exponential Derivative algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/v2/query-data/influxql/functions/aggregates/) in your call to the `TRIPLE_EXPONENTIAL_DERIVATIVE()` function.
|
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/version/query-data/influxql/functions/aggregates/) in your call to the `TRIPLE_EXPONENTIAL_DERIVATIVE()` function.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
`TRIPLE_EXPONENTIAL_DERIVATIVE(/regular_expression/, 2)`
|
`TRIPLE_EXPONENTIAL_DERIVATIVE(/regular_expression/, 2)`
|
||||||
Returns the field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)
|
Returns the field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/)
|
||||||
processed using the Triple Exponential Derivative algorithm with a 2-value period
|
processed using the Triple Exponential Derivative algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`TRIPLE_EXPONENTIAL_DERIVATIVE(*, 2)`
|
`TRIPLE_EXPONENTIAL_DERIVATIVE(*, 2)`
|
||||||
Returns the field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement)
|
Returns the field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement)
|
||||||
processed using the Triple Exponential Derivative algorithm with a 2-value period
|
processed using the Triple Exponential Derivative algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`TRIPLE_EXPONENTIAL_DERIVATIVE()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`TRIPLE_EXPONENTIAL_DERIVATIVE()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
## RELATIVE_STRENGTH_INDEX()
|
## RELATIVE_STRENGTH_INDEX()
|
||||||
|
|
||||||
The relative strength index (RSI) is a momentum indicator that compares the magnitude of recent increases and decreases over a specified time period to measure speed and change of data movements.
|
The relative strength index (RSI) is a momentum indicator that compares the magnitude of recent increases and decreases over a specified time period to measure speed and change of data movements.
|
||||||
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="https://www.investopedia.com/terms/r/rsi.asp" target="\_blank">Source</a>
|
<sup style="line-height:0; font-size:.7rem; font-style:italic; font-weight:normal;"><a href="https://www.investopedia.com/terms/r/rsi.asp" target="\_blank">Source</a>
|
||||||
|
|
||||||
Supports `GROUP BY` clauses that [group by tags](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/v2/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
Supports `GROUP BY` clauses that [group by tags](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-tags) but not `GROUP BY` clauses that [group by time](/influxdb/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals).
|
||||||
|
|
||||||
To use `RELATIVE_STRENGTH_INDEX()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/v2/query-data/influxql/functions/transformations/#advanced-syntax).
|
To use `RELATIVE_STRENGTH_INDEX()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||||
|
|
||||||
### Basic syntax
|
### Basic syntax
|
||||||
|
|
||||||
|
@ -612,35 +612,35 @@ RELATIVE_STRENGTH_INDEX([ * | <field_key> | /regular_expression/ ], <period>[, <
|
||||||
```
|
```
|
||||||
|
|
||||||
`RELATIVE_STRENGTH_INDEX(field_key, 2)`
|
`RELATIVE_STRENGTH_INDEX(field_key, 2)`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Relative Strength Index algorithm with a 2-value period
|
processed using the Relative Strength Index algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`RELATIVE_STRENGTH_INDEX(field_key, 10, 10, 'exponential')`
|
`RELATIVE_STRENGTH_INDEX(field_key, 10, 10, 'exponential')`
|
||||||
Returns the field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Relative Strength Index algorithm with a 10-value period,
|
processed using the Relative Strength Index algorithm with a 10-value period,
|
||||||
a 10-value hold period, and the `exponential` warmup type.
|
a 10-value hold period, and the `exponential` warmup type.
|
||||||
|
|
||||||
`RELATIVE_STRENGTH_INDEX(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
`RELATIVE_STRENGTH_INDEX(MEAN(<field_key>), 2) ... GROUP BY time(1d)`
|
||||||
Returns the mean of field values associated with the [field key](/influxdb/v2/reference/glossary/#field-key)
|
Returns the mean of field values associated with the [field key](/influxdb/version/reference/glossary/#field-key)
|
||||||
processed using the Relative Strength Index algorithm with a 2-value period
|
processed using the Relative Strength Index algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/v2/query-data/influxql/functions/aggregates/) in your call to the `RELATIVE_STRENGTH_INDEX()` function.
|
**Note:** When aggregating data with a `GROUP BY` clause, you must include an [aggregate function](/influxdb/version/query-data/influxql/functions/aggregates/) in your call to the `RELATIVE_STRENGTH_INDEX()` function.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
`RELATIVE_STRENGTH_INDEX(/regular_expression/, 2)`
|
`RELATIVE_STRENGTH_INDEX(/regular_expression/, 2)`
|
||||||
Returns the field values associated with each field key that matches the [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)
|
Returns the field values associated with each field key that matches the [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/)
|
||||||
processed using the Relative Strength Index algorithm with a 2-value period
|
processed using the Relative Strength Index algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`RELATIVE_STRENGTH_INDEX(*, 2)`
|
`RELATIVE_STRENGTH_INDEX(*, 2)`
|
||||||
Returns the field values associated with each field key in the [measurement](/influxdb/v2/reference/glossary/#measurement)
|
Returns the field values associated with each field key in the [measurement](/influxdb/version/reference/glossary/#measurement)
|
||||||
processed using the Relative Strength Index algorithm with a 2-value period
|
processed using the Relative Strength Index algorithm with a 2-value period
|
||||||
and the default hold period and warmup type.
|
and the default hold period and warmup type.
|
||||||
|
|
||||||
`RELATIVE_STRENGTH_INDEX()` supports int64 and float64 field value [data types](/influxdb/v2/query-data/influxql/explore-data/select/#data-types).
|
`RELATIVE_STRENGTH_INDEX()` supports int64 and float64 field value [data types](/influxdb/version/query-data/influxql/explore-data/select/#data-types).
|
||||||
|
|
||||||
**Arguments:**
|
**Arguments:**
|
||||||
- [period](#period)
|
- [period](#period)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,7 +7,7 @@ Use the following data management commands to write and delete data with InfluxQ
|
||||||
|
|
||||||
## Write data with INSERT
|
## Write data with INSERT
|
||||||
|
|
||||||
The `INSERT` statement writes [line protocol](/influxdb/v2/reference/syntax/line-protocol/)
|
The `INSERT` statement writes [line protocol](/influxdb/version/reference/syntax/line-protocol/)
|
||||||
to a database and retention policy.
|
to a database and retention policy.
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
@ -17,9 +17,9 @@ INSERT [INTO <database>[.<retention-policy>]] <line-protocol>
|
||||||
|
|
||||||
- The `INTO` clause is optional.
|
- The `INTO` clause is optional.
|
||||||
If the command does not include `INTO`, you must specify the
|
If the command does not include `INTO`, you must specify the
|
||||||
database with `USE <database_name>` when using the [InfluxQL shell](/influxdb/v2/tools/influxql-shell/)
|
database with `USE <database_name>` when using the [InfluxQL shell](/influxdb/version/tools/influxql-shell/)
|
||||||
or with the `db` query string parameter in the
|
or with the `db` query string parameter in the
|
||||||
[InfluxDB 1.x compatibility API](/influxdb/v2/reference/api/influxdb-1x/) request.
|
[InfluxDB 1.x compatibility API](/influxdb/version/reference/api/influxdb-1x/) request.
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ INSERT INTO mydb example-m,tag1=value1 field1=1i 1640995200000000000
|
||||||
|
|
||||||
#### Insert data into the currently used database
|
#### Insert data into the currently used database
|
||||||
|
|
||||||
The following example uses the [InfluxQL shell](/influxdb/v2/tools/influxql-shell).
|
The following example uses the [InfluxQL shell](/influxdb/version/tools/influxql-shell).
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
> USE mydb
|
> USE mydb
|
||||||
|
@ -50,7 +50,7 @@ The following example uses the [InfluxQL shell](/influxdb/v2/tools/influxql-shel
|
||||||
|
|
||||||
## Delete series with DELETE
|
## Delete series with DELETE
|
||||||
|
|
||||||
The `DELETE` statement deletes all points from a [series](/influxdb/v2/reference/glossary/#series) in a database.
|
The `DELETE` statement deletes all points from a [series](/influxdb/version/reference/glossary/#series) in a database.
|
||||||
|
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
|
@ -58,13 +58,13 @@ The `DELETE` statement deletes all points from a [series](/influxdb/v2/reference
|
||||||
DELETE FROM <measurement_name> WHERE [<tag_key>='<tag_value>'] | [<time interval>]
|
DELETE FROM <measurement_name> WHERE [<tag_key>='<tag_value>'] | [<time interval>]
|
||||||
```
|
```
|
||||||
|
|
||||||
You must include either the [`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause), the [`WHERE` clause](/influxdb/v2/query-data/influxql/explore-data/where/), or both.
|
You must include either the [`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause), the [`WHERE` clause](/influxdb/version/query-data/influxql/explore-data/where/), or both.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
- `DELETE` supports [regular expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)
|
- `DELETE` supports [regular expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/)
|
||||||
in the `FROM` clause when specifying measurement names and in the `WHERE` clause
|
in the `FROM` clause when specifying measurement names and in the `WHERE` clause
|
||||||
when specifying tag values.
|
when specifying tag values.
|
||||||
- `DELETE` does not support [fields](/influxdb/v2/reference/glossary/#field) in the `WHERE` clause.
|
- `DELETE` does not support [fields](/influxdb/version/reference/glossary/#field) in the `WHERE` clause.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -115,7 +115,7 @@ DELETE FROM device_data WHERE "device" = 'sensor15" and time >= '2024-01-01T12:0
|
||||||
|
|
||||||
## Delete measurements with DROP MEASUREMENT
|
## Delete measurements with DROP MEASUREMENT
|
||||||
|
|
||||||
The `DROP MEASUREMENT` statement deletes all data and series from the specified [measurement](/influxdb/v2/reference/glossary/#measurement) and deletes the measurement from the index.
|
The `DROP MEASUREMENT` statement deletes all data and series from the specified [measurement](/influxdb/version/reference/glossary/#measurement) and deletes the measurement from the index.
|
||||||
|
|
||||||
#### Syntax
|
#### Syntax
|
||||||
|
|
||||||
|
|
|
@ -253,7 +253,7 @@ In each case the constant you need can be calculated as `(2 ** width) - 1`.
|
||||||
|
|
||||||
### Mathematical operators with wildcards and regular expressions
|
### Mathematical operators with wildcards and regular expressions
|
||||||
|
|
||||||
InfluxDB does not support combining mathematical operations with a wildcard (`*`) or [regular expression](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/) in the `SELECT` clause.
|
InfluxDB does not support combining mathematical operations with a wildcard (`*`) or [regular expression](/influxdb/version/query-data/influxql/explore-data/regular-expressions/) in the `SELECT` clause.
|
||||||
The following queries are invalid and the system returns an error:
|
The following queries are invalid and the system returns an error:
|
||||||
|
|
||||||
Perform a mathematical operation on a wildcard.
|
Perform a mathematical operation on a wildcard.
|
||||||
|
@ -303,5 +303,5 @@ SELECT mean(10 * "value") FROM "cpu"
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
InfluxQL supports [subqueries](/influxdb/v2/query-data/influxql/explore-data/subqueries/) which offer similar functionality to using mathematical operators inside a function call.
|
InfluxQL supports [subqueries](/influxdb/version/query-data/influxql/explore-data/subqueries/) which offer similar functionality to using mathematical operators inside a function call.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
|
@ -78,7 +78,7 @@ to the underlying data source, so data returned by the
|
||||||
previous function loads into memory.
|
previous function loads into memory.
|
||||||
This often results in a significant performance hit.
|
This often results in a significant performance hit.
|
||||||
|
|
||||||
For example, the following query uses [dashboard variables](/influxdb/v2/visualize-data/variables/)
|
For example, the following query uses [dashboard variables](/influxdb/version/visualize-data/variables/)
|
||||||
and string concatenation to define a region to filter by.
|
and string concatenation to define a region to filter by.
|
||||||
Because `filter()` uses string concatenation inline, it can't push its operation
|
Because `filter()` uses string concatenation inline, it can't push its operation
|
||||||
to the underlying data source and loads all data returned from `range()` into memory.
|
to the underlying data source and loads all data returned from `range()` into memory.
|
||||||
|
@ -153,10 +153,10 @@ data
|
||||||
## Balance time range and data precision
|
## Balance time range and data precision
|
||||||
To ensure queries are performant, balance the time range and the precision of your data.
|
To ensure queries are performant, balance the time range and the precision of your data.
|
||||||
For example, if you query data stored every second and request six months worth of data,
|
For example, if you query data stored every second and request six months worth of data,
|
||||||
results would include ≈15.5 million points per series. Depending on the number of series returned after `filter()`([cardinality](/influxdb/v2/reference/glossary/#series-cardinality)), this can quickly become many billions of points.
|
results would include ≈15.5 million points per series. Depending on the number of series returned after `filter()`([cardinality](/influxdb/version/reference/glossary/#series-cardinality)), this can quickly become many billions of points.
|
||||||
Flux must store these points in memory to generate a response. Use [pushdowns](#pushdown-functions-and-function-combinations) to optimize how many points are stored in memory.
|
Flux must store these points in memory to generate a response. Use [pushdowns](#pushdown-functions-and-function-combinations) to optimize how many points are stored in memory.
|
||||||
|
|
||||||
To query data over large periods of time, create a task to [downsample data](/influxdb/v2/process-data/common-tasks/downsample-data/), and then query the downsampled data instead.
|
To query data over large periods of time, create a task to [downsample data](/influxdb/version/process-data/common-tasks/downsample-data/), and then query the downsampled data instead.
|
||||||
|
|
||||||
## Measure query performance with Flux profilers
|
## Measure query performance with Flux profilers
|
||||||
Use the [Flux Profiler package](/flux/v0/stdlib/profiler/)
|
Use the [Flux Profiler package](/flux/v0/stdlib/profiler/)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue