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
|
||||
|
||||
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.
|
||||
|
||||
### 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
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
```sh
|
||||
|
@ -125,9 +125,9 @@ influx auth create \
|
|||
```
|
||||
|
||||
{{% 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 %}}
|
||||
{{% /show-in %}}
|
||||
|
||||
|
@ -166,19 +166,19 @@ influx auth create \
|
|||
--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
|
||||
|
||||
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:
|
||||
|
||||
| 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.
|
||||
| Permissions list | Pass as a `permissions` array in the request body.
|
||||
|
||||
|
@ -196,5 +196,5 @@ body.
|
|||
```
|
||||
|
||||
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.
|
||||
|
|
|
@ -35,7 +35,7 @@ have access to your InfluxDB instance.
|
|||
|
||||
## 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.
|
||||
|
||||
_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.
|
||||
|
||||
{{< 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:
|
||||
|
||||
| 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. |
|
||||
|
||||
```sh
|
||||
|
|
|
@ -43,7 +43,7 @@ using the InfluxDB user interface (UI).
|
|||
|
||||
## 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.
|
||||
|
||||
_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
|
||||
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
|
||||
influx auth find --json
|
||||
|
@ -63,7 +63,7 @@ influx auth find --json
|
|||
|
||||
### 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.
|
||||
|
||||
_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
|
||||
```
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
{{< 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:
|
||||
|
||||
| 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. |
|
||||
| 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.
|
||||
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
|
||||
|
||||
|
@ -14,19 +14,19 @@ influx write -t $INFLUX_TOKEN -b my-bucket -o my-org "measurement field=1"
|
|||
```
|
||||
|
||||
{{% 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.
|
||||
(Click on the **Windows** tab.)
|
||||
{{% /note %}}
|
||||
|
||||
### 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 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
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
```sh
|
||||
|
@ -55,20 +55,20 @@ influx auth list
|
|||
```
|
||||
|
||||
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.
|
||||
|
||||
## View tokens using the InfluxDB API
|
||||
|
||||
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:
|
||||
|
||||
| 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
|
||||
{{% 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.
|
||||
|
||||
{{% 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
|
||||
|
||||
|
@ -91,9 +91,9 @@ To filter tokens by user, include `userID` as a query parameter in your request.
|
|||
|
||||
{{% 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.
|
||||
|
||||
{{% /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.
|
||||
|
||||
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 %}}
|
||||
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 %}}
|
||||
|
||||
## Bootstrap your application
|
||||
|
||||
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).
|
||||
|
||||
### 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
|
||||
[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.
|
||||
|
||||
|
@ -42,12 +42,12 @@ InfluxDB uses [API tokens](/influxdb/v2/admin/tokens/) to authorize API requests
|
|||
{{% /code-tab-content %}}
|
||||
{{< /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
|
||||
|
||||
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
|
||||
{{% 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 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 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
|
||||
|
||||
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 %}}
|
||||
### 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.
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
@ -72,7 +72,7 @@ For more information and examples, see [Node.js](/influxdb/v2/api-guide/client-l
|
|||
{{% /code-tab-content %}}
|
||||
{{< /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
|
||||
|
||||
|
@ -85,7 +85,7 @@ This library includes an example browser app that queries from and writes to you
|
|||
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]()
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
```
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
1. Install [Node.js](https://nodejs.org/en/download/package-manager/).
|
||||
|
||||
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
|
||||
directory--for example, enter the following command into your terminal:
|
||||
|
@ -69,7 +69,7 @@ Add both as dependencies of your project.
|
|||
|
||||
## 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
|
||||
|
||||
|
@ -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.
|
||||
{{% /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
|
||||
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
|
||||
|
||||
- [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
|
||||
|
||||
|
@ -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.
|
||||
`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.
|
||||
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
|
||||
|
||||
- [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
|
||||
|
||||
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_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.
|
||||
|
||||
```js
|
||||
writeApi.useDefaultTags({region: 'west'})
|
||||
```
|
||||
|
||||
4. Use the `Point()` constructor to create a [point](/influxdb/v2/reference/glossary/#point).
|
||||
1. Call the constructor and provide a [measurement](/influxdb/v2/reference/glossary/#measurement).
|
||||
4. Use the `Point()` constructor to create a [point](/influxdb/version/reference/glossary/#point).
|
||||
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.
|
||||
Provide a `name` and `value`.
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
|
@ -19,7 +19,7 @@ If just getting started, see [Get started with InfluxDB](/influxdb/v2/get-starte
|
|||
|
||||
## 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.
|
||||
|
||||
|
@ -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
|
||||
```
|
||||
|
||||
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
|
||||
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)
|
||||
```
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
* [Authenticate with the Token scheme](#authenticate-with-the-token-scheme)
|
||||
|
@ -16,7 +16,7 @@ credentials.
|
|||
### Authenticate with the Token scheme
|
||||
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.
|
||||
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 %}}
|
||||
#### 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 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 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/version/admin/tokens/) as the password.
|
||||
{{% /note %}}
|
||||
|
||||
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.
|
||||
|
||||
{{% /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:
|
||||
|
||||
- An InfluxDB [org ID](/influxdb/v2/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
|
||||
- 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/v2/admin/buckets/create-bucket/#create-a-bucket-using-the-influxdb-api) named `iot_center_devices` for storing device metadata and API token IDs
|
||||
- An InfluxDB [org ID](/influxdb/version/admin/organizations/view-orgs/)
|
||||
- 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/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/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 %}}
|
||||
|
||||
|
@ -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.
|
||||
|
||||
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).
|
||||
|
||||
```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`.
|
||||
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.
|
||||
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:
|
||||
|
||||
|
@ -413,7 +413,7 @@ the `/api/v2/buckets` InfluxDB API endpoint.
|
|||
- Description: `IoTCenterDevice: DEVICE_ID`.
|
||||
- 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).
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
||||
- An InfluxDB [org ID](/influxdb/v2/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
|
||||
- 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/v2/admin/buckets/create-bucket/#create-a-bucket-using-the-influxdb-api) named `iot_center_devices` for storing device metadata and API token IDs
|
||||
- An InfluxDB [org ID](/influxdb/version/admin/organizations/view-orgs/)
|
||||
- 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/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/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
|
||||
|
||||
|
@ -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`.
|
||||
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.
|
||||
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:
|
||||
|
||||
|
@ -255,7 +255,7 @@ the `/api/v2/buckets` InfluxDB API endpoint.
|
|||
- Description: `IoTCenterDevice: DEVICE_ID`.
|
||||
- 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).
|
||||
|
||||
|
@ -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.
|
||||
|
||||
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).
|
||||
|
||||
```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.
|
||||
"Processing" data could mean transforming, aggregating, downsampling, or alerting
|
||||
on data. This tutorial covers the following data processing use cases:
|
||||
|
@ -102,7 +102,7 @@ from(bucket: "get-started")
|
|||
{{% expand "Perform mathematical operations" %}}
|
||||
|
||||
`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.
|
||||
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" %}}
|
||||
|
||||
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.
|
||||
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).
|
||||
{{% /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/).
|
||||
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.
|
||||
|
||||
{{% 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.
|
||||
{{% /note %}}
|
||||
|
||||
|
@ -421,7 +421,7 @@ This grouping is important as you [aggregate data](#aggregate-or-select-specific
|
|||
{{< expand-wrapper >}}
|
||||
{{% 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.
|
||||
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" %}}
|
||||
|
||||
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.
|
||||
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" %}}
|
||||
|
||||
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
|
||||
`_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" %}}
|
||||
|
||||
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.
|
||||
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" %}}
|
||||
|
||||
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.
|
||||
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" %}}
|
||||
|
||||
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.
|
||||
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" %}}
|
||||
|
||||
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.
|
||||
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" %}}
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
_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."
|
||||
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
|
||||
|
||||
[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.
|
||||
Generally tasks then use the [`to()` function](/flux/v0/stdlib/influxdata/influxdb/to/)
|
||||
to write the processed result back to InfluxDB.
|
||||
|
||||
_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
|
||||
|
||||
|
@ -1252,4 +1252,4 @@ from(bucket: "get-started-downsampled")
|
|||
|> filter(fn: (r) => r._measurement == "home")
|
||||
|> 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 user interface (UI)
|
||||
- [InfluxDB HTTP API](/influxdb/v2/reference/api/)
|
||||
- [`influx` CLI](/influxdb/v2/tools/influx-cli/)
|
||||
- [InfluxDB HTTP API](/influxdb/version/reference/api/)
|
||||
- [`influx` CLI](/influxdb/version/tools/influx-cli/)
|
||||
- [Chronograf](/chronograf/v1/)
|
||||
- [Grafana](/influxdb/v2/tools/grafana/)
|
||||
- [InfluxDB client libraries](/influxdb/v2/api-guide/client-libraries/)
|
||||
- [Grafana](/influxdb/version/tools/grafana/)
|
||||
- [InfluxDB client libraries](/influxdb/version/api-guide/client-libraries/)
|
||||
|
||||
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:
|
||||
|
@ -18,7 +18,7 @@ focuses primarily on the two languages you can use to query your time series dat
|
|||
|
||||
{{% note %}}
|
||||
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 %}}
|
||||
|
||||
###### 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.
|
||||
|
||||
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 "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 %}}
|
||||
<!-------------------------- BEGIN FLUX CLI CONTENT --------------------------->
|
||||
|
||||
1. If you haven't already, [download, install, and configure the `influx` CLI](/influxdb/v2/tools/influx-cli/).
|
||||
2. Use the [`influx query` command](/influxdb/v2/reference/cli/influx/query/)
|
||||
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/version/reference/cli/influx/query/)
|
||||
to query InfluxDB using Flux.
|
||||
|
||||
**Provide the following**:
|
||||
|
||||
- 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
|
||||
influx query '
|
||||
|
@ -252,10 +252,10 @@ from(bucket: "get-started")
|
|||
<!-------------------------- BEGIN FLUX API CONTENT --------------------------->
|
||||
|
||||
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.
|
||||
|
||||
{{< 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:
|
||||
|
||||
|
@ -285,7 +285,7 @@ curl --request POST \
|
|||
|
||||
{{% note %}}
|
||||
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 %}}
|
||||
|
||||
<!--------------------------- 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
|
||||
**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
|
||||
[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 %}}
|
||||
|
||||
### InfluxQL query basics
|
||||
|
@ -437,7 +437,7 @@ SELECT co,hum,temp,room FROM "get-started".autogen.home WHERE time >= '2022-01-0
|
|||
|
||||
{{% note %}}
|
||||
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 %}}
|
||||
|
||||
### 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.
|
||||
For a user interface that builds and executes InfluxQL queries, consider using
|
||||
[Chronograf](/influxdb/v2/tools/chronograf/) or
|
||||
[Grafana](/influxdb/v2/tools/grafana/) with InfluxDB {{< current-version >}}.
|
||||
[Chronograf](/influxdb/version/tools/chronograf/) or
|
||||
[Grafana](/influxdb/version/tools/grafana/) with InfluxDB {{< current-version >}}.
|
||||
{{% /note %}}
|
||||
|
||||
<!-------------------------- END INFLUXQL UI CONTENT -------------------------->
|
||||
|
@ -470,12 +470,12 @@ For a user interface that builds and executes InfluxQL queries, consider using
|
|||
|
||||
{{< cli/influx-creds-note >}}
|
||||
|
||||
1. If you haven't already, [download, install, and configure the `influx` CLI](/influxdb/v2/tools/influx-cli/).
|
||||
2. Use the [`influx v1 shell` command](/influxdb/v2/reference/cli/influx/v1/shell/)
|
||||
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/version/reference/cli/influx/v1/shell/)
|
||||
to start an InfluxQL shell and query InfluxDB using InfluxQL.
|
||||
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
|
||||
influx v1 shell
|
||||
|
@ -493,10 +493,10 @@ For a user interface that builds and executes InfluxQL queries, consider using
|
|||
<!------------------------ BEGIN INFLUXQL API CONTENT ------------------------->
|
||||
|
||||
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.
|
||||
|
||||
{{< 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:
|
||||
|
||||
|
@ -509,8 +509,8 @@ Include the following with your request:
|
|||
- **rp**: Retention policy to query data from.
|
||||
- **q**: InfluxQL query to execute.
|
||||
- **epoch**: _(Optional)_ Return results with
|
||||
[Unix timestamps](/influxdb/v2/reference/glossary/#unix-timestamp) of a
|
||||
specified precision instead of [RFC3339 timestamps](/influxdb/v2/reference/glossary/#rfc3339-timestamp). The following precisions are available:
|
||||
[Unix timestamps](/influxdb/version/reference/glossary/#unix-timestamp) of a
|
||||
specified precision instead of [RFC3339 timestamps](/influxdb/version/reference/glossary/#rfc3339-timestamp). The following precisions are available:
|
||||
|
||||
- `ns` - nanoseconds
|
||||
- `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.
|
||||
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
|
||||
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
|
||||
InfluxDB user interface (UI), [Chronograf](/influxdb/v2/tools/chronograf/), and
|
||||
[Grafana](/influxdb/v2/tools/grafana/).
|
||||
InfluxDB user interface (UI), [Chronograf](/influxdb/version/tools/chronograf/), and
|
||||
[Grafana](/influxdb/version/tools/grafana/).
|
||||
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
|
||||
identify trends and anomalies. A dashboard is comprised of one or more
|
||||
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 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.
|
||||
For this tutorial, we'll use **"Room temperature"**.
|
||||
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.
|
||||
For this tutorial, use the default **Graph** visualization.
|
||||
4. Use the query time range selector to select an absolute time range that
|
||||
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**.
|
||||
|
||||
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
|
||||
specific parts of cell queries.
|
||||
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:
|
||||
|
||||
- `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.
|
||||
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,
|
||||
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
|
||||
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
|
||||
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" />}}
|
||||
|
||||
_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!
|
||||
|
||||
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 >}}.
|
||||
Feel free to dive in deeper to each of these topics:
|
||||
|
||||
- [Write data to InfluxDB](/influxdb/v2/write-data/)
|
||||
- [Query data in InfluxDB](/influxdb/v2/query-data/)
|
||||
- [Process data with InfluxDB](/influxdb/v2/process-data/)
|
||||
- [Visualize data with the InfluxDB UI](/influxdb/v2/visualize-data/)
|
||||
- [Write data to InfluxDB](/influxdb/version/write-data/)
|
||||
- [Query data in InfluxDB](/influxdb/version/query-data/)
|
||||
- [Process data with InfluxDB](/influxdb/version/process-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:
|
||||
|
||||
- Influx user interface (UI)
|
||||
- [InfluxDB HTTP API](/influxdb/v2/reference/api/)
|
||||
- [`influx` CLI](/influxdb/v2/tools/influx-cli/)
|
||||
- [InfluxDB HTTP API](/influxdb/version/reference/api/)
|
||||
- [`influx` CLI](/influxdb/version/tools/influx-cli/)
|
||||
- [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
|
||||
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
|
||||
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,
|
||||
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
|
||||
|
||||
|
@ -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._
|
||||
- {{< 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 values can be [strings](/influxdb/v2/reference/syntax/line-protocol/#string) (quoted),
|
||||
[floats](/influxdb/v2/reference/syntax/line-protocol/#float),
|
||||
[integers](/influxdb/v2/reference/syntax/line-protocol/#integer),
|
||||
[unsigned integers](/influxdb/v2/reference/syntax/line-protocol/#uinteger),
|
||||
or [booleans](/influxdb/v2/reference/syntax/line-protocol/#boolean).
|
||||
- **timestamp**: [Unix timestamp](/influxdb/v2/reference/syntax/line-protocol/#unix-timestamp)
|
||||
Field values can be [strings](/influxdb/version/reference/syntax/line-protocol/#string) (quoted),
|
||||
[floats](/influxdb/version/reference/syntax/line-protocol/#float),
|
||||
[integers](/influxdb/version/reference/syntax/line-protocol/#integer),
|
||||
[unsigned integers](/influxdb/version/reference/syntax/line-protocol/#uinteger),
|
||||
or [booleans](/influxdb/version/reference/syntax/line-protocol/#boolean).
|
||||
- **timestamp**: [Unix timestamp](/influxdb/version/reference/syntax/line-protocol/#unix-timestamp)
|
||||
associated with the data. InfluxDB supports up to nanosecond precision.
|
||||
_If the precision of the timestamp is not in nanoseconds, you must specify the
|
||||
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
|
||||
|
||||
|
@ -148,8 +148,8 @@ The UI will confirm that the data has been written successfully.
|
|||
{{% tab-content %}}
|
||||
<!---------------------------- BEGIN CLI CONTENT ----------------------------->
|
||||
|
||||
1. If you haven't already, [download, install, and configure the `influx` CLI](/influxdb/v2/tools/influx-cli/).
|
||||
2. Use the [`influx write` command](/influxdb/v2/reference/cli/influx/write/)
|
||||
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/version/reference/cli/influx/write/)
|
||||
to write the [line protocol above](#home-sensor-data-line-protocol) to InfluxDB.
|
||||
|
||||
**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.
|
||||
- `-p, --precision` flag with the timestamp precision (`s`).
|
||||
- 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
|
||||
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
|
||||
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:
|
||||
|
||||
|
@ -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
|
||||
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 developer tools](/influxdb/v2/write-data/developer-tools/)
|
||||
- [Write data to InfluxDB using no-code solutions](/influxdb/version/write-data/no-code/)
|
||||
- [Write data to InfluxDB using developer tools](/influxdb/version/write-data/developer-tools/)
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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.
|
||||
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
|
||||
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.
|
||||
|
||||
## Create an alert
|
||||
|
||||
To get started, do the following:
|
||||
|
||||
1. [Create checks](/influxdb/v2/monitor-alert/checks/create/) to monitor data and assign a status.
|
||||
2. [Add notification endpoints](/influxdb/v2/monitor-alert/notification-endpoints/create/)
|
||||
1. [Create checks](/influxdb/version/monitor-alert/checks/create/) to monitor data and assign a status.
|
||||
2. [Add notification endpoints](/influxdb/version/monitor-alert/notification-endpoints/create/)
|
||||
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.
|
||||
|
||||
## 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.
|
||||
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
|
||||
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.
|
||||
|
||||
{{% 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.
|
||||
{{% /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.
|
||||
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
|
||||
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):
|
||||
[`threshold`](/influxdb/v2/monitor-alert/checks/create/#threshold-check) and
|
||||
[`deadman`](/influxdb/v2/monitor-alert/checks/create/#deadman-check).
|
||||
In the UI, you can create two kinds of [checks](/influxdb/version/reference/glossary/#check):
|
||||
[`threshold`](/influxdb/version/monitor-alert/checks/create/#threshold-check) and
|
||||
[`deadman`](/influxdb/version/monitor-alert/checks/create/#deadman-check).
|
||||
|
||||
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 >}}**.
|
||||
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`).
|
||||
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.
|
||||
|
||||
{{% 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.
|
||||
This can be useful for constructing custom checks.
|
||||
{{% /note %}}
|
||||
|
@ -79,7 +79,7 @@ task_data
|
|||
{{% note %}}
|
||||
Creating a custom check does not send a notification email.
|
||||
For information on how to create notification emails, see
|
||||
[Create notification endpoints](/influxdb/v2/monitor-alert/notification-endpoints/create),
|
||||
[Create notification rules](/influxdb/v2/monitor-alert/notification-rules/create),
|
||||
and [Send alert email](/influxdb/v2/monitor-alert/send-email/)
|
||||
[Create notification endpoints](/influxdb/version/monitor-alert/notification-endpoints/create),
|
||||
[Create notification rules](/influxdb/version/monitor-alert/notification-rules/create),
|
||||
and [Send alert email](/influxdb/version/monitor-alert/send-email/)
|
||||
{{% /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" %}}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
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.
|
||||
|
||||
## Delete a notification endpoint
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
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**
|
||||
|
||||
|
@ -23,7 +23,7 @@ To update the notification endpoint selected for a notification rule, see [updat
|
|||
## Change endpoint details
|
||||
1. Click the name of the endpoint to update.
|
||||
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
|
||||
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.
|
||||
_For details, see [Manage checks](/influxdb/v2/monitor-alert/checks/) and
|
||||
[Manage notification endpoints](/influxdb/v2/monitor-alert/notification-endpoints/)._
|
||||
_For details, see [Manage checks](/influxdb/version/monitor-alert/checks/) and
|
||||
[Manage notification endpoints](/influxdb/version/monitor-alert/notification-endpoints/)._
|
||||
|
||||
|
||||
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:
|
||||
|
||||
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):
|
||||
- **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).
|
||||
|
@ -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.
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
### 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 >}}**.
|
||||
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`.
|
||||
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)):
|
||||
- Import the [Flux HTTP package](/flux/v0/stdlib/http/).
|
||||
- (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/).
|
||||
- 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)`.
|
||||
|
|
|
@ -3,23 +3,23 @@ Use the [AWS CloudWatch Monitoring template](https://github.com/influxdata/commu
|
|||
|
||||
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 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`
|
||||
- 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
|
||||
|
||||
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
|
||||
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/).
|
||||
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/).
|
||||
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/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:
|
||||
|
||||
```sh
|
||||
|
@ -37,7 +37,7 @@ The AWS CloudWatch Monitoring template includes the following:
|
|||
organization = "$INFLUX_ORG"
|
||||
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
|
||||
|
||||
|
|
|
@ -4,39 +4,39 @@ This template uses the [Docker input plugin](/telegraf/v1/plugins//#docker) to c
|
|||
|
||||
The Docker Monitoring template includes the following:
|
||||
|
||||
- one [dashboard](/influxdb/v2/reference/glossary/#dashboard): **Docker**
|
||||
- one [bucket](/influxdb/v2/reference/glossary/#bucket): `docker, 7d retention`
|
||||
- one [dashboard](/influxdb/version/reference/glossary/#dashboard): **Docker**
|
||||
- one [bucket](/influxdb/version/reference/glossary/#bucket): `docker, 7d retention`
|
||||
- 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`
|
||||
- four [checks](/influxdb/v2/reference/glossary/#check): `Container cpu`, `mem`, `disk`, `non-zero exit`
|
||||
- one [notification endpoint](/influxdb/v2/reference/glossary/#notification-endpoint): `Http Post`
|
||||
- one [notification rule](/influxdb/v2/reference/glossary/#notification-rule): `Crit Alert`
|
||||
- four [checks](/influxdb/version/reference/glossary/#check): `Container cpu`, `mem`, `disk`, `non-zero exit`
|
||||
- one [notification endpoint](/influxdb/version/reference/glossary/#notification-endpoint): `Http Post`
|
||||
- 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
|
||||
|
||||
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
|
||||
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 %}}
|
||||
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 %}}
|
||||
|
||||
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/).
|
||||
3. In your [Telegraf configuration file (`telegraf.conf`)](/influxdb/v2/tools/telegraf-configs/), do the following:
|
||||
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/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.
|
||||
- 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_ORG: Name of your organization. See how to [view your organization](/influxdb/v2/admin/organizations/view-orgs/).
|
||||
- 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/version/admin/organizations/view-orgs/).
|
||||
- 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
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ to monitor your Raspberry Pi 4 or 400 Linux system.
|
|||
|
||||
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
|
||||
- [Diskio input plugin](/telegraf/v1/plugins//#diskio)
|
||||
- [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)
|
||||
- [Swap input plugin](/telegraf/v1/plugins//#swap)
|
||||
- [System input plugin](/telegraf/v1/plugins//#system)
|
||||
- one [Telegraf configuration](/influxdb/v2/tools/telegraf-configs/)
|
||||
- one [dashboard](/influxdb/v2/reference/glossary/#dashboard): Raspberry Pi System
|
||||
- one [Telegraf configuration](/influxdb/version/tools/telegraf-configs/)
|
||||
- one [dashboard](/influxdb/version/reference/glossary/#dashboard): Raspberry Pi System
|
||||
- two variables: `bucket` and `linux_host`
|
||||
|
||||
## 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
|
||||
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
|
||||
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:
|
||||
|
||||
- `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 %}}
|
||||
- `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.
|
||||
|
||||
```sh
|
||||
|
@ -40,7 +40,7 @@ The Raspberry Pi template includes the following:
|
|||
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
|
||||
|
||||
|
|
|
@ -4,30 +4,30 @@ This template uses the [Docker input plugin](/telegraf/v1/plugins//#docker) to c
|
|||
|
||||
The Docker Monitoring template includes the following:
|
||||
|
||||
- one [dashboard](/influxdb/v2/reference/glossary/#dashboard): **vsphere**
|
||||
- one [bucket](/influxdb/v2/reference/glossary/#bucket): `vsphere`
|
||||
- one [dashboard](/influxdb/version/reference/glossary/#dashboard): **vsphere**
|
||||
- one [bucket](/influxdb/version/reference/glossary/#bucket): `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`
|
||||
|
||||
## 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
|
||||
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 %}}
|
||||
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 %}}
|
||||
|
||||
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/).
|
||||
3. In your [Telegraf configuration file (`telegraf.conf`)](/influxdb/v2/tools/telegraf-configs/), do the following:
|
||||
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/version/tools/telegraf-configs/), do the following:
|
||||
- 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_ORG: Name of your organization. See how to [view your organization](/influxdb/v2/admin/organizations/view-orgs/).
|
||||
- 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/version/admin/organizations/view-orgs/).
|
||||
- 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`
|
||||
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"
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -3,33 +3,33 @@ Use the [Windows System Monitoring template](https://github.com/influxdata/commu
|
|||
|
||||
The Windows System Monitoring template includes the following:
|
||||
|
||||
- one [dashboard](/influxdb/v2/reference/glossary/#dashboard): **Windows System**
|
||||
- one [bucket](/influxdb/v2/reference/glossary/#bucket): `telegraf`, 7d retention
|
||||
- one [dashboard](/influxdb/version/reference/glossary/#dashboard): **Windows System**
|
||||
- one [bucket](/influxdb/version/reference/glossary/#bucket): `telegraf`, 7d retention
|
||||
- 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`
|
||||
|
||||
## 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
|
||||
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 %}}
|
||||
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 %}}
|
||||
|
||||
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/).
|
||||
3. In your [Telegraf configuration file (`telegraf.conf`)](/influxdb/v2/tools/telegraf-configs/), do the following:
|
||||
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/version/tools/telegraf-configs/), do the following:
|
||||
- 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_ORG: Name of your organization. See how to [view your organization](/influxdb/v2/admin/organizations/view-orgs/).
|
||||
- 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/version/admin/organizations/view-orgs/).
|
||||
- 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.
|
||||
|
||||
## View incoming data
|
||||
|
|
|
@ -17,7 +17,7 @@ Do 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))
|
||||
- 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
|
||||
- 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))
|
||||
|
@ -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
|
||||
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,
|
||||
[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:
|
||||
|
||||
## 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:
|
||||
|
||||
- one [dashboard](/influxdb/v2/reference/glossary/#dashboard): **HAProxy**
|
||||
- one [bucket](/influxdb/v2/reference/glossary/#bucket): `haproxy`
|
||||
- one [dashboard](/influxdb/version/reference/glossary/#dashboard): **HAProxy**
|
||||
- one [bucket](/influxdb/version/reference/glossary/#bucket): `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`
|
||||
|
||||
## 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
|
||||
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/).
|
||||
3. In your [Telegraf configuration file (`telegraf.conf`)](/influxdb/v2/tools/telegraf-configs/), do the following:
|
||||
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/version/tools/telegraf-configs/), do the following:
|
||||
- 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_ORG: Name of your organization. See how to [view your organization](/influxdb/v2/admin/organizations/view-orgs/).
|
||||
- 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/version/admin/organizations/view-orgs/).
|
||||
- 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
|
||||
|
||||
|
|
|
@ -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}
|
||||
```
|
||||
|
||||
_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._
|
||||
|
||||
_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)._
|
||||
|
||||
{{% 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.
|
||||
{{% /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" %}}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
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)
|
||||
- [`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.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
|
||||
{{% note %}}
|
||||
|
@ -45,7 +45,7 @@ The InfluxDB UI provides multiple ways to create a task:
|
|||
##### Leave out the option tasks assignment
|
||||
|
||||
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}`.
|
||||
{{% /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.
|
||||
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.
|
||||
5. Click **{{< caps >}}Save{{< /caps >}}** in the upper right.
|
||||
|
||||
|
@ -117,9 +117,9 @@ option task = {
|
|||
|
||||
{{% 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:
|
||||
##### Request headers
|
||||
|
@ -132,7 +132,7 @@ Provide the following in your API request:
|
|||
JSON object with the following fields:
|
||||
|
||||
- **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")
|
||||
- **description**: task description
|
||||
|
||||
|
|
|
@ -19,17 +19,17 @@ influx task delete -i <task-id>
|
|||
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
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
```sh
|
||||
|
@ -52,13 +52,13 @@ influx task retry-failed \
|
|||
```
|
||||
|
||||
## 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.
|
||||
|
||||
{{< 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
|
||||
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.
|
||||
|
||||
{{< 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.
|
||||
{{% /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
|
||||
|
||||
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.
|
||||
|
||||
{{< 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
|
||||
|
||||
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.
|
||||
|
||||
{{< 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
|
||||
|
||||
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
|
||||
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.
|
||||
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.
|
||||
|
||||
```sh
|
||||
|
@ -61,13 +61,13 @@ influx task update -i 0343698431c35000 --status inactive
|
|||
```
|
||||
|
||||
## 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.
|
||||
To activate or inactivate a task, set the `status` property.
|
||||
`"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.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
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 >}}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<!-- Shortcode -->
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
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:
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ The result shows that 88.66% of time production is in the `OK` state, and that 1
|
|||
|
||||
#### 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
|
||||
from(bucket: "machine")
|
||||
|
|
|
@ -47,7 +47,7 @@ to align multiple fields by time.
|
|||
{{% note %}}
|
||||
To correctly pivot on `_time`, points for each field must have identical timestamps.
|
||||
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 %}}
|
||||
|
||||
```js
|
||||
|
|
|
@ -6,7 +6,7 @@ Use the following common queries to operate on columns:
|
|||
- [Calculate a new column](#calculate-a-new-column)
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
## 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.
|
||||
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
|
||||
|
||||
Flux is a functional data scripting language designed for querying,
|
||||
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**.
|
||||
|
||||
|
@ -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.
|
||||
- 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.
|
||||
- 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.
|
||||
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.
|
||||
|
@ -33,7 +33,7 @@ See [Get started with Flux](/influxdb/v2/query-data/get-started) to learn more a
|
|||
|
||||
## 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" />}}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
```sh
|
||||
./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:
|
||||
|
||||
- Send a Flux query request to the [`/api/v2/query`](/influxdb/v2/api/#operation/PostQueryAnalyze) endpoint.
|
||||
- Send an InfluxQL query request to the [/query 1.x compatibility API](/influxdb/v2/reference/api/influxdb-1x/query/).
|
||||
- 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/version/reference/api/influxdb-1x/query/).
|
||||
|
||||
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-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.
|
||||
|
||||
###### 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/),
|
||||
[`range()`](/flux/v0/stdlib/universe/range/) and
|
||||
[`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.
|
||||
3. Use [`map()`](/flux/v0/stdlib/universe/map/)
|
||||
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 %}}
|
||||
The following examples use `pivot()` to align operands into rows because
|
||||
`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 %}}
|
||||
|
||||
```js
|
||||
|
@ -151,7 +151,7 @@ from(bucket: "example-bucket")
|
|||
|
||||
#### 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.
|
||||
3. Use `group()` to ungroup data and return a single table.
|
||||
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:
|
||||
|
||||
- [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
|
||||
```js
|
||||
|
@ -59,7 +59,7 @@ overdue = if dueDate < now() then true else false
|
|||
```
|
||||
|
||||
### 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.
|
||||
`metric` has three possible values:
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ to calculate a running total of values.
|
|||
{{< /flex >}}
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
##### Calculate the running total of values
|
||||
|
@ -40,7 +40,7 @@ data
|
|||
[`aggregateWindow()`](/flux/v0/stdlib/universe/aggregatewindow/)
|
||||
segments data into windows of time, aggregates data in each window into a single
|
||||
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.
|
||||
To use `cumulativeSum()` with `aggregateWindow`, use `sum` in `aggregateWindow()`,
|
||||
|
|
|
@ -122,7 +122,7 @@ from(bucket: "example-bucket")
|
|||
|
||||
## Define functions with scoped variables
|
||||
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.
|
||||
|
||||
```js
|
||||
|
|
|
@ -128,7 +128,7 @@ it isn't included in the output table.
|
|||
|
||||
## Custom aggregate function examples
|
||||
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.
|
||||
|
||||
### 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:
|
||||
|
||||
- [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 (
|
||||
[`filter()`](/flux/v0/stdlib/universe/filter/),
|
||||
|
|
|
@ -9,7 +9,7 @@ data stored in InfluxDB.
|
|||
- [List tag values](#list-tag-values)
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
## 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
|
||||
following visualization types:
|
||||
|
||||
- [Single Stat](/influxdb/v2/visualize-data/visualization-types/single-stat/)
|
||||
- [Table](/influxdb/v2/visualize-data/visualization-types/table/)
|
||||
- [Single Stat](/influxdb/version/visualize-data/visualization-types/single-stat/)
|
||||
- [Table](/influxdb/version/visualize-data/visualization-types/table/)
|
||||
|
||||
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**
|
||||
_(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)_
|
||||
- Query to execute
|
||||
|
||||
|
@ -85,9 +85,9 @@ Table: keys: []
|
|||
{{% tab-content %}}
|
||||
|
||||
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:
|
||||
|
||||
- InfluxDB {{% show-in "cloud,cloud-serverless" %}}Cloud{{% /show-in %}} host
|
||||
|
@ -118,7 +118,7 @@ curl --request POST \
|
|||
|
||||
{{% warn %}}
|
||||
#### 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
|
||||
of Flux installed in the instance of InfluxDB you're querying.
|
||||
{{% /warn %}}
|
|
@ -29,7 +29,7 @@ By using it, you agree to the [risks of experimental functions](/flux/v0/stdlib/
|
|||
## Sample data
|
||||
Many of the examples in this section use a `sampleGeoData` variable that represents
|
||||
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
|
||||
[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)
|
||||
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**:
|
||||
|
||||
```js
|
||||
|
|
|
@ -6,7 +6,7 @@ to group data into tracks or routes.
|
|||
- [Group data into tracks or routes](#group-data-by-track-or-route)
|
||||
|
||||
{{% 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.
|
||||
{{% /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)
|
||||
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:
|
||||
|
||||
```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 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 each bird:
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ Grid and S2 cell ID accuracy are defined by a [level](https://s2geometry.io/reso
|
|||
|
||||
{{% note %}}
|
||||
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 %}}
|
||||
|
||||
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:
|
||||
|
||||
- [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
|
||||
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:
|
||||
|
||||
- [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
|
||||
|
||||
|
@ -51,12 +51,12 @@ logarithmicBins(start: 1.0, factor: 2.0, count: 10, infinity: true)
|
|||
```
|
||||
|
||||
## 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.
|
||||
|
||||
{{< 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.
|
||||
|
||||
### 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:
|
||||
|
||||
- [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
|
||||
```js
|
||||
|
@ -22,7 +22,7 @@ If you're just getting started with Flux queries, check out the following:
|
|||
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 %}}
|
||||
#### Operands must be the same type
|
||||
|
@ -53,7 +53,7 @@ For example:
|
|||
{{% /note %}}
|
||||
|
||||
## 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.
|
||||
|
||||
###### Custom multiplication function
|
||||
|
@ -75,7 +75,7 @@ percent(sample: 20.0, total: 80.0)
|
|||
### Transform values in a data stream
|
||||
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)_.
|
||||
- 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
|
||||
```
|
||||
|
||||
_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
|
||||
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 >}}
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
## Find the value that represents the median
|
||||
|
@ -117,7 +117,7 @@ data
|
|||
[`aggregateWindow()`](/flux/v0/stdlib/universe/aggregatewindow/)
|
||||
segments data into windows of time, aggregates data in each window into a single
|
||||
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
|
||||
[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:
|
||||
|
||||
- [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
|
||||
|
||||
|
@ -122,13 +122,13 @@ from(bucket: "servers")
|
|||
|
||||
<!--## 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.
|
||||
|
||||
{{< 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.
|
||||
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:
|
||||
|
|
|
@ -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:
|
||||
|
||||
- [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 %}}
|
||||
|
||||
|
||||
|
@ -23,8 +23,8 @@ If you're just getting started with Flux queries, check out the following:
|
|||
|
||||
### Unix nanosecond to RFC3339
|
||||
Use the [`time()` function](/flux/v0/stdlib/universe/time/)
|
||||
to convert a [Unix **nanosecond** timestamp](/influxdb/v2/reference/glossary/#unix-timestamp)
|
||||
to an [RFC3339 timestamp](/influxdb/v2/reference/glossary/#rfc3339-timestamp).
|
||||
to convert a [Unix **nanosecond** timestamp](/influxdb/version/reference/glossary/#unix-timestamp)
|
||||
to an [RFC3339 timestamp](/influxdb/version/reference/glossary/#rfc3339-timestamp).
|
||||
|
||||
```js
|
||||
time(v: 1568808000000000000)
|
||||
|
|
|
@ -95,7 +95,7 @@ If calculating the `0.5` quantile or 50th percentile:
|
|||
{{< /flex >}}
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
## Find the value representing the 99th percentile
|
||||
|
@ -131,7 +131,7 @@ data
|
|||
[`aggregateWindow()`](/flux/v0/stdlib/universe/aggregatewindow/)
|
||||
segments data into windows of time, aggregates data in each window into a single
|
||||
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
|
||||
`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.
|
||||
|
||||
## The filter() function
|
||||
`filter()` has an `fn` parameter that expects a [predicate function](/influxdb/v2/reference/glossary/#predicate-function),
|
||||
an anonymous function comprised of one or more [predicate expressions](/influxdb/v2/reference/glossary/#predicate-expression).
|
||||
`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/version/reference/glossary/#predicate-expression).
|
||||
The predicate function evaluates each input row.
|
||||
Rows that evaluate to `true` are **included** in 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),
|
||||
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.
|
||||
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:
|
||||
|
||||
- [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
|
||||
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:
|
||||
|
||||
- [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
|
||||
|
||||
|
|
|
@ -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
|
||||
like [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/),
|
||||
[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:
|
||||
|
||||
- [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
|
||||
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.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.
|
||||
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.
|
||||
|
@ -188,13 +188,13 @@ Use the variable to manipulate queries in your dashboards.
|
|||
---
|
||||
|
||||
## 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.
|
||||
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
|
||||
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.
|
||||
|
||||
{{< tabs-wrapper >}}
|
||||
|
@ -216,8 +216,8 @@ curl --request PATCH http://localhost:8086/api/v2/orgs/<org-id>/secrets \
|
|||
|
||||
**To store secrets, you need:**
|
||||
|
||||
- [your organization ID](/influxdb/v2/admin/organizations/view-orgs/#view-your-organization-id)
|
||||
- [your API token](/influxdb/v2/admin/tokens/view-tokens/)
|
||||
- [your organization ID](/influxdb/version/admin/organizations/view-orgs/#view-your-organization-id)
|
||||
- [your API token](/influxdb/version/admin/tokens/view-tokens/)
|
||||
{{% /tab-content %}}
|
||||
{{% tab-content %}}
|
||||
```sh
|
||||
|
@ -286,8 +286,8 @@ Sample sensor information is stored in PostgreSQL.
|
|||
|
||||
#### Download sample air sensor data
|
||||
|
||||
1. [Create a bucket](/influxdb/v2/admin/buckets/create-bucket/) to store the data.
|
||||
2. [Create an InfluxDB task](/influxdb/v2/process-data/manage-tasks/create-task/)
|
||||
1. [Create a bucket](/influxdb/version/admin/buckets/create-bucket/) to store the data.
|
||||
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/)
|
||||
to download sample air sensor data every 15 minutes.
|
||||
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")
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
```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>
|
||||
|
||||
_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:
|
||||
|
||||
- [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 %}}
|
||||
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.
|
||||
|
||||
## 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.
|
||||
|
||||
## 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
|
||||
[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.
|
||||
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.
|
||||
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 %}}
|
||||
|
||||
## 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:
|
||||
|
||||
```js
|
||||
|
@ -24,7 +24,7 @@ from(bucket: "example-bucket")
|
|||
|
||||
## Flux functions
|
||||
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._
|
||||
|
||||
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,
|
||||
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)
|
||||
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.
|
||||
|
||||
**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
|
||||
|
||||
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 %}}
|
||||
|
||||
## 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/).
|
||||
_For examples, see [List DBRP mappings](/influxdb/v2/query-data/influxql/dbrp/#list-dbrp-mappings)._
|
||||
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/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.
|
||||
|
||||
## 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.
|
||||
_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
|
||||
|
||||
|
@ -44,12 +44,12 @@ _For examples, see [Create DBRP mappings](/influxdb/v2/query-data/influxql/dbrp/
|
|||
{{% tab-content %}}
|
||||
<!---------------------------- 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:
|
||||
|
||||
- [Download and install the `influx` CLI](/influxdb/v2/tools/influx-cli/#install-the-influx-cli)
|
||||
- [Configure your authentication credentials](/influxdb/v2/tools/influx-cli/#provide-required-authentication-credentials)
|
||||
- [Download and install the `influx` CLI](/influxdb/version/tools/influx-cli/#install-the-influx-cli)
|
||||
- [Configure your authentication credentials](/influxdb/version/tools/influx-cli/#provide-required-authentication-credentials)
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
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 ---------------------------->
|
||||
{{% /tab-content %}}
|
||||
{{% tab-content %}}
|
||||
<!----------------------------- 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 >}}.
|
||||
|
||||
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`
|
||||
- **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:**
|
||||
- **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)_
|
||||
|
@ -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.
|
||||
|
||||
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 ----------------------------->
|
||||
{{% /tab-content %}}
|
||||
{{< /tabs-wrapper >}}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
InfluxQL requires a database and retention policy (DBRP) combination in order to query data.
|
||||
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
|
||||
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
|
||||
during the following operations:
|
||||
|
||||
- Writing to the [`/write` v1 compatibility endpoint](/influxdb/v2/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 "v2" %}}- [Upgrading from InfluxDB 1.x to {{< current-version noSpan=true >}}](/influxdb/v2/upgrade/v1-to-v2/){{% /show-in %}}
|
||||
- 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/version/upgrade/v1-to-cloud/){{% /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 %}}
|
||||
|
||||
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" %}}
|
||||
|
||||
|
@ -37,14 +37,14 @@ Virtual DBRP mappings are read-only.
|
|||
To override a virtual DBRP mapping, [create an explicit mapping](#create-dbrp-mappings).
|
||||
|
||||
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 %}}
|
||||
|
||||
## Create DBRP mappings
|
||||
|
||||
Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) or the
|
||||
[InfluxDB API](/influxdb/v2/reference/api/) to create DBRP mappings.
|
||||
Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) or the
|
||||
[InfluxDB API](/influxdb/version/reference/api/) to create DBRP mappings.
|
||||
|
||||
{{% note %}}
|
||||
#### A DBRP combination can only be mapped to a single bucket
|
||||
|
@ -60,16 +60,16 @@ it will overwrite the existing DBRP mapping.
|
|||
{{% /tabs %}}
|
||||
{{% 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.
|
||||
Include the following:
|
||||
|
||||
{{< 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 "\*" >}} **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
|
||||
|
||||
```sh
|
||||
|
@ -83,22 +83,22 @@ influx v1 dbrp create \
|
|||
{{% /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:
|
||||
|
||||
- **Request method:** `POST`
|
||||
- **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`
|
||||
- **Request body:** JSON object with the following fields:
|
||||
{{< 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
|
||||
- **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
|
||||
|
||||
<!-- -->
|
||||
|
@ -120,7 +120,7 @@ curl --request POST http://localhost:8086/api/v2/dbrps \
|
|||
|
||||
## 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 a database and retention policy.
|
||||
|
||||
|
@ -131,11 +131,11 @@ to a database and retention policy.
|
|||
{{% /tabs %}}
|
||||
{{% 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 %}}
|
||||
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.
|
||||
{{% /note %}}
|
||||
|
||||
|
@ -155,19 +155,19 @@ influx v1 dbrp list --bucket-id 00oxo0oXx000x0Xo
|
|||
```
|
||||
{{% /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:
|
||||
|
||||
- **Request method:** `GET`
|
||||
- **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:**
|
||||
{{< req type="key" >}}
|
||||
- {{< req "\*" >}} **orgID:** [organization ID](/influxdb/v2/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)_
|
||||
- {{< req "\*" >}} **orgID:** [organization ID](/influxdb/version/admin/organizations/view-orgs/#view-your-organization-id)
|
||||
- **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)_
|
||||
- **rp:** retention policy name _(to list DBRP mappings with a specific retention policy name)_
|
||||
- **id:** DBRP mapping ID _(to list a specific DBRP mapping)_
|
||||
|
@ -197,8 +197,8 @@ curl --request GET \
|
|||
|
||||
## Update a DBRP mapping
|
||||
|
||||
Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) or the
|
||||
[InfluxDB API](/influxdb/v2/reference/api/) to update a DBRP mapping.
|
||||
Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) or the
|
||||
[InfluxDB API](/influxdb/version/reference/api/) to update a DBRP mapping.
|
||||
|
||||
{{% show-in "v2" %}}
|
||||
|
||||
|
@ -216,13 +216,13 @@ To override a virtual DBRP mapping, [create an explicit mapping](#create-dbrp-ma
|
|||
{{% /tabs %}}
|
||||
{{% 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.
|
||||
Include the following:
|
||||
|
||||
{{< 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
|
||||
- **Retention policy** name to update to
|
||||
- **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 %}}
|
||||
|
||||
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:
|
||||
|
||||
|
@ -248,11 +248,11 @@ Include the following:
|
|||
|
||||
- **Request method:** `PATCH`
|
||||
- **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:**
|
||||
- {{< req "\*" >}} **id:** DBRP mapping ID to update
|
||||
- **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):**
|
||||
- **rp:** retention policy name to update to
|
||||
- **default:** set the retention policy as the default retention policy for the database
|
||||
|
@ -272,8 +272,8 @@ curl --request PATCH \
|
|||
|
||||
## Delete a DBRP mapping
|
||||
|
||||
Use the [`influx` CLI](/influxdb/v2/reference/cli/influx/) or the
|
||||
[InfluxDB API](/influxdb/v2/reference/api/) to delete a DBRP mapping.
|
||||
Use the [`influx` CLI](/influxdb/version/reference/cli/influx/) or the
|
||||
[InfluxDB API](/influxdb/version/reference/api/) to delete a DBRP mapping.
|
||||
|
||||
{{% show-in "v2" %}}
|
||||
|
||||
|
@ -290,13 +290,13 @@ Virtual DBRP mappings cannot be deleted.
|
|||
{{% /tabs %}}
|
||||
{{% 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.
|
||||
Include the following:
|
||||
|
||||
{{< 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
|
||||
|
||||
```sh
|
||||
|
@ -306,9 +306,9 @@ influx v1 dbrp delete --id 00oxo0X0xx0XXoX0
|
|||
{{% /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:
|
||||
|
||||
|
@ -316,11 +316,11 @@ Include the following:
|
|||
|
||||
- **Request method:** `PATCH`
|
||||
- **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:**
|
||||
- {{< req "\*" >}} **id:** DBRP mapping ID to update
|
||||
- **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
|
||||
curl --request DELETE \
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
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).
|
||||
|
||||
|
@ -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.
|
||||
|
||||
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:
|
||||
|
||||
|
@ -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 | 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.
|
||||
This measurement has one [tag key](/influxdb/v2/reference/glossary/#tag-key)
|
||||
(`location`) which has two [tag values](/influxdb/v2/reference/glossary/#tag-value):
|
||||
This measurement has one [tag key](/influxdb/version/reference/glossary/#tag-key)
|
||||
(`location`) which has two [tag values](/influxdb/version/reference/glossary/#tag-value):
|
||||
`coyote_creek` and `santa_monica`.
|
||||
The measurement also has two [fields](/influxdb/v2/reference/glossary/#field):
|
||||
`level description` stores string [field values](/influxdb/v2/reference/glossary/#field-value)
|
||||
The measurement also has two [fields](/influxdb/version/reference/glossary/#field):
|
||||
`level description` stores string [field values](/influxdb/version/reference/glossary/#field-value)
|
||||
and `water_level` stores float field values.
|
||||
|
||||
|
||||
### 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.
|
||||
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:
|
||||
|
||||
```sql
|
||||
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.
|
||||
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:** 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 <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
|
||||
|
||||
|
@ -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>]]
|
||||
```
|
||||
|
||||
- `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>,<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.
|
||||
|
||||
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 |
|
||||
|
||||
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
|
||||
[tag value](/influxdb/v2/reference/glossary/#tag-value) of `location` in
|
||||
the `h2o_feet` [measurement](/influxdb/v2/reference/glossary/#measurement).
|
||||
InfluxDB returns results in two [series](/influxdb/v2/reference/glossary/#series): one for each tag value of `location`.
|
||||
[tag value](/influxdb/version/reference/glossary/#tag-value) of `location` in
|
||||
the `h2o_feet` [measurement](/influxdb/version/reference/glossary/#measurement).
|
||||
InfluxDB returns results in two [series](/influxdb/version/reference/glossary/#series): one for each tag value of `location`.
|
||||
|
||||
{{% 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.
|
||||
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 %}}
|
||||
|
||||
{{% /expand %}}
|
||||
|
@ -134,7 +134,7 @@ tags: location=santa_monica, randtag=3
|
|||
| :------------------- | ------------: |
|
||||
| 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
|
||||
`h2o_quality` measurement.
|
||||
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 |
|
||||
|
||||
The query uses the InfluxQL [MEAN() function](/influxdb/v2/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`
|
||||
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/version/reference/glossary/#tag) combination in the `h2o_quality`
|
||||
measurement.
|
||||
|
||||
{{% /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>)]
|
||||
```
|
||||
|
||||
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.
|
||||
Note that the `GROUP BY` clause must come **after** the `WHERE` clause.
|
||||
|
||||
##### `time(time_interval)`
|
||||
|
||||
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.
|
||||
For example, a `time_interval` of `5m` groups query results into five-minute
|
||||
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: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.
|
||||
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: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.
|
||||
Note that the time interval and the tag key are separated by a comma in the
|
||||
`GROUP BY` clause.
|
||||
|
||||
The query returns two [series](/influxdb/v2/reference/glossary/#series) of results: one for each
|
||||
[tag value](/influxdb/v2/reference/glossary/#tag-value) of the `location` tag.
|
||||
The query returns two [series](/influxdb/version/reference/glossary/#series) of results: one for each
|
||||
[tag value](/influxdb/version/reference/glossary/#tag-value) of the `location` tag.
|
||||
The result for each timestamp 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`.
|
||||
|
@ -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>)]
|
||||
```
|
||||
|
||||
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
|
||||
`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)
|
||||
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.
|
||||
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: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.
|
||||
|
||||
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 |
|
||||
|
||||
|
||||
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.
|
||||
|
||||
{{% note %}}
|
||||
|
@ -703,7 +703,7 @@ Name: h2o_feet
|
|||
| :------------------- | -----------: |
|
||||
| 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:
|
||||
|
||||
|
@ -775,7 +775,7 @@ By default, a `GROUP BY time()` interval with no data reports `null` as its
|
|||
value in the output column.
|
||||
`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
|
||||
`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
|
||||
|
||||
|
|
|
@ -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)
|
||||
- [Syntax](#syntax)
|
||||
|
@ -11,7 +11,7 @@ Use `LIMIT` and `SLIMIT` to limit the number of [points](/influxdb/v2/reference/
|
|||
|
||||
## 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
|
||||
|
||||
|
@ -45,7 +45,7 @@ Name: h2o_feet
|
|||
| 2019-08-17T00:00:00Z | 2.0640000000 |santa_monica |
|
||||
| 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 %}}
|
||||
|
||||
|
@ -75,7 +75,7 @@ tags: location=santa_monica
|
|||
| 2019-08-18T00:00:00Z | 2.3655000000 |
|
||||
| 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.
|
||||
|
||||
|
@ -85,7 +85,7 @@ Note that without `LIMIT 2`, the query would return four points per series; one
|
|||
|
||||
## 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
|
||||
|
||||
|
@ -122,7 +122,7 @@ tags: location=coyote_creek
|
|||
| 2019-08-17T00:30:00Z | 7.5000000000|
|
||||
| 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 %}}
|
||||
|
||||
|
@ -145,8 +145,8 @@ tags: location=coyote_creek
|
|||
| 2019-08-18T00:24:00Z | 8.0710000000|
|
||||
| 2019-08-18T00:36:00Z | 7.8330000000|
|
||||
|
||||
The query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean)
|
||||
and a time interval in the [GROUP BY clause](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
||||
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/version/query-data/influxql/explore-data/group-by/)
|
||||
to calculate the average `water_level` for each 12-minute
|
||||
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
|
||||
|
||||
`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
|
||||
|
||||
|
|
|
@ -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)
|
||||
- [Syntax](#syntax)
|
||||
|
@ -10,7 +10,7 @@ Use `OFFSET` and `SOFFSET` to paginate [points](/influxdb/v2/reference/glossary/
|
|||
|
||||
## `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
|
||||
|
||||
|
@ -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]
|
||||
```
|
||||
|
||||
`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:** 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 | 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.
|
||||
|
||||
{{% /expand %}}
|
||||
|
@ -67,14 +67,14 @@ tags: location=coyote_creek
|
|||
|
||||
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 [`FROM clause`] (/influxdb/v2/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 [`GROUP BY` clause](/influxdb/v2/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 [`LIMIT 2` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/) limits the number of points returned to two.
|
||||
- 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/version/query-data/influxql/explore-data/select/#from-clause) specifies a single measurement.
|
||||
- The [`WHERE` clause](/influxdb/version/query-data/influxql/explore-data/where/) specifies the time range for the query.
|
||||
- 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/version/query-data/influxql/explore-data/order-by/#order-by-time-desc) returns results in descending timestamp order.
|
||||
- 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 [`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:
|
||||
|
||||
|
@ -95,7 +95,7 @@ tags: location=coyote_creek
|
|||
|
||||
## `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
|
||||
|
||||
|
@ -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>
|
||||
```
|
||||
|
||||
`N` specifies the number of [series](/influxdb/v2/reference/glossary/#series) to paginate.
|
||||
The `SOFFSET` clause requires an [`SLIMIT` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/.
|
||||
`N` specifies the number of [series](/influxdb/version/reference/glossary/#series) to paginate.
|
||||
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
|
||||
query results](https://github.com/influxdata/influxdb/issues/7578).
|
||||
`SLIMIT` queries must include `GROUP BY *`.
|
||||
|
@ -165,15 +165,15 @@ tags: location=santa_monica
|
|||
|
||||
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 [`FROM` clause](/influxdb/v2/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 [`GROUP BY` clause](/influxdb/v2/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 [`LIMIT 2` clause](/influxdb/v2/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 [`SLIMIT 1` clause](/influxdb/v2/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 [`SELECT` clause](/influxdb/version/query-data/influxql/explore-data/select/) specifies an InfluxQL [function](/influxdb/version/query-data/influxql/functions/).
|
||||
- The [`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause) specifies a single measurement.
|
||||
- The [`WHERE` clause](/influxdb/version/query-data/influxql/explore-data/where/) specifies the time range for the query.
|
||||
- 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/version/query-data/influxql/explore-data/order-by/#order-by-time-desc) returns results in descending timestamp order.
|
||||
- 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/version/query-data/influxql/explore-data/offset-and-soffset/) excludes the first two averages from the query results.
|
||||
- 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/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:
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ Use the `ORDER BY` clause to sort data.
|
|||
|
||||
## ORDER BY time DESC
|
||||
|
||||
By default, InfluxDB returns results in ascending time order; the first [point](/influxdb/v2/reference/glossary/#point)
|
||||
returned has the oldest [timestamp](/influxdb/v2/reference/glossary/#timestamp) and
|
||||
By default, InfluxDB returns results in ascending time order; the first [point](/influxdb/version/reference/glossary/#point)
|
||||
returned has the oldest [timestamp](/influxdb/version/reference/glossary/#timestamp) and
|
||||
the last point returned has the most recent timestamp.
|
||||
`ORDER BY time DESC` reverses that order such that InfluxDB returns the points
|
||||
with the most recent timestamps first.
|
||||
|
@ -44,7 +44,7 @@ Name: h2o_feet
|
|||
| 2019-09-17T21:18:00Z | 5.0720000000|
|
||||
|
||||
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:
|
||||
|
||||
Output:
|
||||
|
@ -78,11 +78,11 @@ Name: h2o_feet
|
|||
| 2019-08-18T00:12:00Z | 5.3042500000|
|
||||
| 2019-08-18T00:00:00Z | 5.4135000000|
|
||||
|
||||
The query uses the InfluxQL [MEAN() function](/influxdb/v2/query-data/influxql/functions/aggregates/#mean)
|
||||
and a time interval in the [GROUP BY clause](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
||||
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/version/query-data/influxql/explore-data/group-by/)
|
||||
to calculate the average `water_level` for each 12-minute
|
||||
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.
|
||||
|
||||
Without `ORDER BY time DESC`, the query would return the following output:
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
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/).
|
||||
- [measurements](/influxdb/v2/reference/glossary/#measurement) in the [`FROM` clause](/influxdb/v2/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 keys](/influxdb/v2/reference/glossary/#tag-key) in the [`GROUP BY` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
||||
- [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/version/reference/glossary/#measurement) in the [`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause).
|
||||
- [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/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:** Regular expression comparisons are more computationally intensive than exact
|
||||
|
@ -119,7 +119,7 @@ Name: h2o_feet
|
|||
| :------------------- | ---------------------:|
|
||||
| 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.
|
||||
|
||||
{{% /expand %}}
|
||||
|
@ -148,7 +148,7 @@ Name: h2o_feet
|
|||
| :------------------ | ---------------------:|
|
||||
| 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 %}}
|
||||
|
||||
|
@ -167,7 +167,7 @@ Name: h2o_feet
|
|||
| :------------------ | ---------------------:|
|
||||
| 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 %}}
|
||||
|
||||
|
@ -179,10 +179,10 @@ SELECT * FROM "h2o_feet" WHERE "location" !~ /./
|
|||
```
|
||||
|
||||
The query selects all data from the `h2o_feet` measurement where the `location`
|
||||
[tag](/influxdb/v2/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`.
|
||||
[tag](/influxdb/version/reference/glossary/#tag) has no value.
|
||||
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.
|
||||
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.
|
||||
|
||||
{{% /expand %}}
|
||||
|
@ -202,7 +202,7 @@ Name: h2o_feet
|
|||
| :------------------ | ---------------------:|
|
||||
| 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 %}}
|
||||
|
||||
|
@ -222,7 +222,7 @@ Name: h2o_feet
|
|||
| 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`.
|
||||
|
||||
{{% /expand %}}
|
||||
|
@ -253,7 +253,7 @@ tags: location=santa_monica
|
|||
| :------------------ |-------------------:|
|
||||
| 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`
|
||||
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)
|
||||
- [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:
|
||||
|
||||
- `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>","<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>"::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.
|
||||
|
||||
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)
|
||||
- [Regular expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)
|
||||
- [Regular expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/)
|
||||
|
||||
{{% 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).
|
||||
|
@ -43,7 +43,7 @@ Other supported features include:
|
|||
### `FROM` clause
|
||||
|
||||
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>,<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
|
||||
|
||||
[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).
|
||||
While not always necessary, we recommend that you double quote identifiers.
|
||||
|
||||
{{% note %}}
|
||||
**Note:** InfluxQL quoting guidelines differ from [line protocol quoting guidelines](/influxdb/v2/reference/syntax/line-protocol/#quotes).
|
||||
Please review the [rules for single and double-quoting](/influxdb/v2/reference/syntax/line-protocol/#quotes) in queries.
|
||||
**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/version/reference/syntax/line-protocol/#quotes) in queries.
|
||||
{{% /note %}}
|
||||
|
||||
### 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: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
|
||||
[tags](/influxdb/v2/reference/glossary/#tag) from the `h2o_feet`
|
||||
[measurement](/influxdb/v2/reference/glossary/#measurement).
|
||||
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/version/reference/glossary/#tag) from the `h2o_feet`
|
||||
[measurement](/influxdb/version/reference/glossary/#measurement).
|
||||
|
||||
{{% /expand %}}
|
||||
|
||||
|
@ -137,7 +137,7 @@ Name: h2o_feet
|
|||
The query selects the `level description` field, the `location` tag, and the
|
||||
`water_level` field from the `h2o_feet` measurement.
|
||||
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).
|
||||
That syntax is not required for most use cases.
|
||||
|
||||
|
@ -191,7 +191,7 @@ values.
|
|||
|
||||
{{% note %}}
|
||||
**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.
|
||||
{{% /note %}}
|
||||
|
||||
|
@ -266,9 +266,9 @@ The `..` indicates the `DEFAULT` retention policy for the specified database.
|
|||
|
||||
### 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.
|
||||
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.
|
||||
|
||||
#### Example
|
||||
|
@ -304,11 +304,11 @@ Name: h2o_feet
|
|||
|
||||
## Regular expressions
|
||||
|
||||
InfluxQL supports using [regular expressions](/influxdb/v2/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/)
|
||||
- [measurements](/influxdb/v2/reference/glossary/#measurement) in the [`FROM` clause](/influxdb/v2/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 keys](/influxdb/v2/reference/glossary/#tag-key) in the [`GROUP BY` clause](/influxdb/v2/query-data/influxql/explore-data/group-by/)
|
||||
InfluxQL supports using [regular expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/) when specifying:
|
||||
- [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/version/reference/glossary/#measurement) in the [`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause)
|
||||
- [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/version/reference/glossary/#tag-key) in the [`GROUP BY` clause](/influxdb/version/query-data/influxql/explore-data/group-by/)
|
||||
|
||||
## 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>/
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
- [Cast operations](#cast-operations)
|
||||
|
||||
### 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.
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
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
|
||||
`SELECT` clause.
|
||||
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.
|
||||
|
||||
### Syntax
|
||||
|
@ -373,7 +373,7 @@ The query returns values of the `water_level` field key that are floats.
|
|||
## Cast operations
|
||||
|
||||
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.
|
||||
|
||||
### Syntax
|
||||
|
@ -407,7 +407,7 @@ Name: h2o_feet
|
|||
| 2019-08-17T00:06:00Z | 8.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 %}}
|
||||
|
||||
|
@ -426,7 +426,7 @@ The query returns no data as casting a float field value to a string is not yet
|
|||
|
||||
## Merge behavior
|
||||
|
||||
InfluxQL merges [series](/influxdb/v2/reference/glossary/#series) automatically.
|
||||
InfluxQL merges [series](/influxdb/version/reference/glossary/#series) automatically.
|
||||
|
||||
### Example
|
||||
|
||||
|
@ -434,10 +434,10 @@ InfluxQL merges [series](/influxdb/v2/reference/glossary/#series) automatically.
|
|||
|
||||
{{% 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 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 `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/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
|
||||
SELECT MEAN("water_level") FROM "h2o_feet"
|
||||
|
@ -451,7 +451,7 @@ Name: h2o_feet
|
|||
| :------------------ |-------------------:|
|
||||
| 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
|
||||
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 |
|
||||
|
||||
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
|
||||
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 %}}
|
||||
|
||||
In the [InfluxQL shell](/influxdb/v2/tools/influxql-shell/):
|
||||
In the [InfluxQL shell](/influxdb/version/tools/influxql-shell/):
|
||||
|
||||
```sql
|
||||
SELECT MEAN("water_level") FROM "h2o_feet"; SELECT "water_level" FROM "h2o_feet" LIMIT 2
|
||||
|
@ -535,7 +535,7 @@ Name: h2o_feet
|
|||
|
||||
{{% tab-content %}}
|
||||
|
||||
With the [InfluxDB API](/influxdb/v2/reference/api/influxdb-1x/):
|
||||
With the [InfluxDB API](/influxdb/version/reference/api/influxdb-1x/):
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ SELECT_clause FROM ( SELECT_statement ) [...]
|
|||
|
||||
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 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.
|
||||
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 %}}
|
||||
|
||||
|
@ -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`.
|
||||
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 %}}
|
||||
|
||||
|
@ -271,7 +271,7 @@ SELECT_clause FROM ( SELECT_clause FROM ( SELECT_statement ) [...] ) [...]
|
|||
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
|
||||
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
|
||||
|
||||
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.
|
||||
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.
|
||||
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
|
||||
|
||||
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 `SELECT` statements with a [`GROUP BY time()` clause](/influxdb/v2/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).
|
||||
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/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/version/reference/glossary/#now).
|
||||
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:
|
||||
[Absolute time](#absolute-time)
|
||||
|
@ -58,7 +58,7 @@ SELECT_clause FROM_clause WHERE time <operator> ['<rfc3339_date_time_string>' |
|
|||
| `<=` | less than or equal to |
|
||||
|
||||
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)
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
duration literal.
|
||||
|
||||
|
@ -249,7 +249,7 @@ September 18, 2019 at 21:24:00. Note that the whitespace between the `-` and `6m
|
|||
|
||||
## 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
|
||||
|
||||
|
@ -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.
|
||||
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
|
||||
| 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.
|
||||
|
||||
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
|
||||
|
||||
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).
|
||||
For `SELECT` statements with a [`GROUP BY time()` clause](/influxdb/v2/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).
|
||||
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/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/version/reference/glossary/#now).
|
||||
|
||||
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
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
Use the `WHERE` clause to filter data based on
|
||||
[fields](/influxdb/v2/reference/glossary/#field),
|
||||
[tags](/influxdb/v2/reference/glossary/#tag), and/or
|
||||
[timestamps](/influxdb/v2/reference/glossary/#timestamp).
|
||||
[fields](/influxdb/version/reference/glossary/#field),
|
||||
[tags](/influxdb/version/reference/glossary/#tag), and/or
|
||||
[timestamps](/influxdb/version/reference/glossary/#timestamp).
|
||||
|
||||
- [Syntax](#syntax)
|
||||
- [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]
|
||||
```
|
||||
|
||||
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.
|
||||
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 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
|
||||
|
||||
|
@ -56,7 +56,7 @@ InfluxQL also supports [Regular Expressions](/influxdb/v2/query-data/influxql/ex
|
|||
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.
|
||||
Queries with unquoted tag values or double quoted tag values will not return
|
||||
any data and, in most cases,
|
||||
|
@ -72,11 +72,11 @@ any data and, in most cases,
|
|||
|
||||
#### 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 `SELECT` statements with a [`GROUP BY time()` clause](/influxdb/v2/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).
|
||||
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/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/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
|
||||
|
||||
|
@ -153,7 +153,7 @@ Name: h2o_feet
|
|||
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.
|
||||
|
||||
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.
|
||||
|
||||
{{% /expand %}}
|
||||
|
@ -186,7 +186,7 @@ time water_level
|
|||
2019-09-18T21:42:00Z 4.938 -->
|
||||
|
||||
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.
|
||||
|
||||
{{% /expand %}}
|
||||
|
@ -225,8 +225,8 @@ separating logic with parentheses.
|
|||
SELECT * FROM "h2o_feet" WHERE time > now() - 7d
|
||||
```
|
||||
|
||||
The query returns data from the `h2o_feet` measurement with [timestamps](/influxdb/v2/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.
|
||||
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/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
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ Use the following InfluxQL commands to explore your schema:
|
|||
- [SHOW TAG KEY CARDINALITY](#show-tag-key-cardinality)
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
## SHOW SERIES
|
||||
|
||||
Return a list of [series](/influxdb/v2/reference/glossary/#series) for
|
||||
the specified [database](/influxdb/v2/reference/glossary/#database).
|
||||
Return a list of [series](/influxdb/version/reference/glossary/#series) for
|
||||
the specified [database](/influxdb/version/reference/glossary/#database).
|
||||
|
||||
### Syntax
|
||||
|
||||
|
@ -28,7 +28,7 @@ SHOW SERIES [ON <database_name>] [FROM_clause] [WHERE <tag_key> <operator> [ '<t
|
|||
- `ON <database_name>` is optional.
|
||||
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.
|
||||
[InfluxDB API](/influxdb/version/reference/api/influxdb-1x/) request.
|
||||
- `FROM`, `WHERE`, `LIMIT`, and `OFFSET` clauses are optional.
|
||||
- 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
|
||||
- `!~`: doesn't match against
|
||||
|
||||
See [Explore data using InfluxQL](/influxdb/v2/query-data/influxql/explore-data/) for documentation on the
|
||||
[`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause),
|
||||
[`LIMIT` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/),
|
||||
[`OFFSET` clause](/influxdb/v2/query-data/influxql/explore-data/offset-and-soffset/),
|
||||
and [Regular Expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
||||
See [Explore data using InfluxQL](/influxdb/version/query-data/influxql/explore-data/) for documentation on the
|
||||
[`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause),
|
||||
[`LIMIT` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/),
|
||||
[`OFFSET` clause](/influxdb/version/query-data/influxql/explore-data/offset-and-soffset/),
|
||||
and [Regular Expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -57,9 +57,9 @@ SHOW SERIES ON noaa
|
|||
**Output:**
|
||||
|
||||
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.
|
||||
Everything before the first comma is the [measurement](/influxdb/v2/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).
|
||||
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/version/reference/glossary/#measurement) name.
|
||||
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.
|
||||
|
||||
| key |
|
||||
|
@ -97,8 +97,8 @@ The `LIMIT` clause limits the number of series returned to two.
|
|||
|
||||
## SHOW MEASUREMENTS
|
||||
|
||||
Returns a list of [measurements](/influxdb/v2/reference/glossary/#measurement)
|
||||
for the specified [database](/influxdb/v2/reference/glossary/#database).
|
||||
Returns a list of [measurements](/influxdb/version/reference/glossary/#measurement)
|
||||
for the specified [database](/influxdb/version/reference/glossary/#database).
|
||||
|
||||
### Syntax
|
||||
|
||||
|
@ -109,7 +109,7 @@ SHOW MEASUREMENTS [ON <database_name>] [WITH MEASUREMENT <operator> ['<measureme
|
|||
- `ON <database_name>` is optional.
|
||||
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.
|
||||
[InfluxDB API](/influxdb/version/reference/api/influxdb-1x/) request.
|
||||
|
||||
- The `WITH`, `WHERE`, `LIMIT` and `OFFSET` clauses are optional.
|
||||
- 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
|
||||
- `!~`: doesn't match against
|
||||
|
||||
See [Explore data using InfluxQL](/influxdb/v2/query-data/influxql/explore-data/) for documentation on the
|
||||
[`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause),
|
||||
[`LIMIT` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/),
|
||||
[`OFFSET` clause](/influxdb/v2/query-data/influxql/explore-data/offset-and-soffset/),
|
||||
and [Regular Expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
||||
See [Explore data using InfluxQL](/influxdb/version/query-data/influxql/explore-data/) for documentation on the
|
||||
[`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause),
|
||||
[`LIMIT` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/),
|
||||
[`OFFSET` clause](/influxdb/version/query-data/influxql/explore-data/offset-and-soffset/),
|
||||
and [Regular Expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -183,8 +183,8 @@ values for the tag key `randtag` that include an integer.
|
|||
|
||||
## SHOW TAG KEYS
|
||||
|
||||
Returns a list of [tag keys](/influxdb/v2/reference/glossary/#tag-key)
|
||||
associated with the specified [database](/influxdb/v2/reference/glossary/#database).
|
||||
Returns a list of [tag keys](/influxdb/version/reference/glossary/#tag-key)
|
||||
associated with the specified [database](/influxdb/version/reference/glossary/#database).
|
||||
|
||||
### Syntax
|
||||
|
||||
|
@ -194,7 +194,7 @@ SHOW TAG KEYS [ON <database_name>] [FROM_clause] WITH KEY [ [<operator> "<tag_ke
|
|||
|
||||
- `ON <database_name>` is optional.
|
||||
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 `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
|
||||
- `!~`: doesn't match against
|
||||
|
||||
See [Explore data using InfluxQL](/influxdb/v2/query-data/influxql/explore-data/) for documentation on the
|
||||
[`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause),
|
||||
[`LIMIT` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/),
|
||||
[`OFFSET` clause](/influxdb/v2/query-data/influxql/explore-data/offset-and-soffset/),
|
||||
and [Regular Expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
||||
See [Explore data using InfluxQL](/influxdb/version/query-data/influxql/explore-data/) for documentation on the
|
||||
[`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause),
|
||||
[`LIMIT` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/),
|
||||
[`OFFSET` clause](/influxdb/version/query-data/influxql/explore-data/offset-and-soffset/),
|
||||
and [Regular Expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -273,8 +273,8 @@ SHOW TAG KEYS ON noaa WITH KEY IN ("location")
|
|||
|
||||
## SHOW TAG VALUES
|
||||
|
||||
Returns the list of [tag values](/influxdb/v2/reference/glossary/#tag-value)
|
||||
for the specified [tag key(s)](/influxdb/v2/reference/glossary/#tag-key) in the database.
|
||||
Returns the list of [tag values](/influxdb/version/reference/glossary/#tag-value)
|
||||
for the specified [tag key(s)](/influxdb/version/reference/glossary/#tag-key) in the database.
|
||||
|
||||
### Syntax
|
||||
|
||||
|
@ -284,7 +284,7 @@ SHOW TAG VALUES [ON <database_name>][FROM_clause] WITH KEY [ [<operator> "<tag_k
|
|||
|
||||
- `ON <database_name>` is optional.
|
||||
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.
|
||||
It supports specifying a single tag key, a regular expression, and multiple tag keys.
|
||||
- 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
|
||||
- `!~`: doesn't match against
|
||||
|
||||
See [Explore data using InfluxQL](/influxdb/v2/query-data/influxql/explore-data/) for documentation on the
|
||||
[`FROM` clause](/influxdb/v2/query-data/influxql/explore-data/select/#from-clause),
|
||||
[`LIMIT` clause](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/),
|
||||
[`OFFSET` clause](/influxdb/v2/query-data/influxql/explore-data/offset-and-soffset/),
|
||||
and [Regular Expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/).
|
||||
See [Explore data using InfluxQL](/influxdb/version/query-data/influxql/explore-data/) for documentation on the
|
||||
[`FROM` clause](/influxdb/version/query-data/influxql/explore-data/select/#from-clause),
|
||||
[`LIMIT` clause](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/),
|
||||
[`OFFSET` clause](/influxdb/version/query-data/influxql/explore-data/offset-and-soffset/),
|
||||
and [Regular Expressions](/influxdb/version/query-data/influxql/explore-data/regular-expressions/).
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -351,9 +351,9 @@ name: h2o_quality
|
|||
|
||||
## SHOW FIELD KEYS
|
||||
|
||||
Returns the [field keys](/influxdb/v2/reference/glossary/#field-key) and the
|
||||
[data type](/influxdb/v2/reference/glossary/#data-type) of their
|
||||
[field values](/influxdb/v2/reference/glossary/#field-value).
|
||||
Returns the [field keys](/influxdb/version/reference/glossary/#field-key) and the
|
||||
[data type](/influxdb/version/reference/glossary/#data-type) of their
|
||||
[field values](/influxdb/version/reference/glossary/#field-value).
|
||||
|
||||
### Syntax
|
||||
|
||||
|
@ -363,16 +363,16 @@ SHOW FIELD KEYS [ON <database_name>] [FROM <measurement_name>]
|
|||
|
||||
- `ON <database_name>` is optional.
|
||||
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
|
||||
[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.
|
||||
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:** A field's data type [can differ](/influxdb/v2/reference/faq/#how-does-influxdb-handle-field-type-discrepancies-across-shards) across
|
||||
[shards](/influxdb/v2/reference/glossary/#shard).
|
||||
**Note:** A field's data type [can differ](/influxdb/version/reference/faq/#how-does-influxdb-handle-field-type-discrepancies-across-shards) across
|
||||
[shards](/influxdb/version/reference/glossary/#shard).
|
||||
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.
|
||||
{{% /note %}}
|
||||
|
@ -419,8 +419,8 @@ measurement in the `noaa` database.
|
|||
|
||||
#### SHOW FIELD KEYS and field type discrepancies
|
||||
|
||||
Field value [data types](/influxdb/v2/reference/glossary/#data-type)
|
||||
cannot differ within a [shard](/influxdb/v2/reference/glossary/#shard) but they
|
||||
Field value [data types](/influxdb/version/reference/glossary/#data-type)
|
||||
cannot differ within a [shard](/influxdb/version/reference/glossary/#shard) but they
|
||||
can differ across shards.
|
||||
`SHOW FIELD KEYS` returns every data type, across every shard, associated with
|
||||
the field key.
|
||||
|
@ -479,7 +479,7 @@ SHOW TAG VALUES EXACT CARDINALITY WITH KEY = "myTagKey" -->
|
|||
|
||||
<!-- ### 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.
|
||||
|
||||
|
|
|
@ -2,64 +2,64 @@
|
|||
Use InfluxQL functions to aggregate, select, transform, analyze, and predict data.
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
## InfluxQL functions (by type)
|
||||
|
||||
- [Aggregates](/influxdb/v2/query-data/influxql/functions/aggregates/)
|
||||
- [COUNT()](/influxdb/v2/query-data/influxql/functions/aggregates/#count)
|
||||
- [DISTINCT()](/influxdb/v2/query-data/influxql/functions/aggregates/#distinct)
|
||||
- [INTEGRAL()](/influxdb/v2/query-data/influxql/functions/aggregates/#integral)
|
||||
- [MEAN()](/influxdb/v2/query-data/influxql/functions/aggregates/#mean)
|
||||
- [MEDIAN()](/influxdb/v2/query-data/influxql/functions/aggregates/#median)
|
||||
- [MODE()](/influxdb/v2/query-data/influxql/functions/aggregates/#mode)
|
||||
- [SPREAD()](/influxdb/v2/query-data/influxql/functions/aggregates/#spread)
|
||||
- [STDDEV()](/influxdb/v2/query-data/influxql/functions/aggregates/#stddev)
|
||||
- [SUM()](/influxdb/v2/query-data/influxql/functions/aggregates/#sum)
|
||||
- [Selectors](/influxdb/v2/query-data/influxql/functions/selectors/)
|
||||
- [BOTTOM()](/influxdb/v2/query-data/influxql/functions/selectors/#bottom)
|
||||
- [FIRST()](/influxdb/v2/query-data/influxql/functions/selectors/#first)
|
||||
- [LAST()](/influxdb/v2/query-data/influxql/functions/selectors/#last)
|
||||
- [MAX()](/influxdb/v2/query-data/influxql/functions/selectors/#max)
|
||||
- [MIN()](/influxdb/v2/query-data/influxql/functions/selectors/#min)
|
||||
- [PERCENTILE()](/influxdb/v2/query-data/influxql/functions/selectors/#percentile)
|
||||
- [SAMPLE()](/influxdb/v2/query-data/influxql/functions/selectors/#sample)
|
||||
- [TOP()](/influxdb/v2/query-data/influxql/functions/selectors/#top)
|
||||
- [Transformations](/influxdb/v2/query-data/influxql/functions/transformations/)
|
||||
- [ABS()](/influxdb/v2/query-data/influxql/functions/transformations/#abs)
|
||||
- [ACOS()](/influxdb/v2/query-data/influxql/functions/transformations/#acos)
|
||||
- [ASIN()](/influxdb/v2/query-data/influxql/functions/transformations/#asin)
|
||||
- [ATAN()](/influxdb/v2/query-data/influxql/functions/transformations/#atan)
|
||||
- [ATAN2()](/influxdb/v2/query-data/influxql/functions/transformations/#atan2)
|
||||
- [CEIL()](/influxdb/v2/query-data/influxql/functions/transformations/#ceil)
|
||||
- [COS()](/influxdb/v2/query-data/influxql/functions/transformations/#cos)
|
||||
- [CUMULATIVE_SUM()](/influxdb/v2/query-data/influxql/functions/transformations/#cumulative_sum)
|
||||
- [DERIVATIVE()](/influxdb/v2/query-data/influxql/functions/transformations/#derivative)
|
||||
- [DIFFERENCE()](/influxdb/v2/query-data/influxql/functions/transformations/#difference)
|
||||
- [ELAPSED()](/influxdb/v2/query-data/influxql/functions/transformations/#elapsed)
|
||||
- [EXP()](/influxdb/v2/query-data/influxql/functions/transformations/#exp)
|
||||
- [FLOOR()](/influxdb/v2/query-data/influxql/functions/transformations/#floor)
|
||||
- [HISTOGRAM()](/influxdb/v2/query-data/influxql/functions/transformations/#histogram)
|
||||
- [LN()](/influxdb/v2/query-data/influxql/functions/transformations/#ln)
|
||||
- [LOG()](/influxdb/v2/query-data/influxql/functions/transformations/#log)
|
||||
- [LOG2()](/influxdb/v2/query-data/influxql/functions/transformations/#log2)
|
||||
- [LOG10()](/influxdb/v2/query-data/influxql/functions/transformations/#log10)
|
||||
- [MOVING_AVERAGE()](/influxdb/v2/query-data/influxql/functions/transformations/#moving_average)
|
||||
- [NON_NEGATIVE_DERIVATIVE()](/influxdb/v2/query-data/influxql/functions/transformations/#non_negative_derivative)
|
||||
- [NON_NEGATIVE_DIFFERENCE()](/influxdb/v2/query-data/influxql/functions/transformations/#non_negative_difference)
|
||||
- [POW()](/influxdb/v2/query-data/influxql/functions/transformations/#pow)
|
||||
- [ROUND()](/influxdb/v2/query-data/influxql/functions/transformations/#round)
|
||||
- [SIN()](/influxdb/v2/query-data/influxql/functions/transformations/#sin)
|
||||
- [SQRT()](/influxdb/v2/query-data/influxql/functions/transformations/#sqrt)
|
||||
- [TAN()](/influxdb/v2/query-data/influxql/functions/transformations/#tan)
|
||||
- [Technical analysis](/influxdb/v2/query-data/influxql/functions/technical-analysis/)
|
||||
- (Predictive analysis) [HOLT_WINTERS()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#holt_winters)
|
||||
- [CHANDE_MOMENTUM_OSCILLATOR()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#chande_momentum_oscillator)
|
||||
- [EXPONENTIAL_MOVING_AVERAGE()](/influxdb/v2/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)
|
||||
- [KAUFMANS_EFFICIENCY_RATIO()](/influxdb/v2/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)
|
||||
- [TRIPLE_EXPONENTIAL_MOVING_AVERAGE()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#triple_exponential_moving_average)
|
||||
- [TRIPLE_EXPONENTIAL_DERIVATIVE()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#triple_exponential_derivative)
|
||||
- [RELATIVE_STRENGTH_INDEX()](/influxdb/v2/query-data/influxql/functions/technical-analysis/#relative_strength_index)
|
||||
- [Aggregates](/influxdb/version/query-data/influxql/functions/aggregates/)
|
||||
- [COUNT()](/influxdb/version/query-data/influxql/functions/aggregates/#count)
|
||||
- [DISTINCT()](/influxdb/version/query-data/influxql/functions/aggregates/#distinct)
|
||||
- [INTEGRAL()](/influxdb/version/query-data/influxql/functions/aggregates/#integral)
|
||||
- [MEAN()](/influxdb/version/query-data/influxql/functions/aggregates/#mean)
|
||||
- [MEDIAN()](/influxdb/version/query-data/influxql/functions/aggregates/#median)
|
||||
- [MODE()](/influxdb/version/query-data/influxql/functions/aggregates/#mode)
|
||||
- [SPREAD()](/influxdb/version/query-data/influxql/functions/aggregates/#spread)
|
||||
- [STDDEV()](/influxdb/version/query-data/influxql/functions/aggregates/#stddev)
|
||||
- [SUM()](/influxdb/version/query-data/influxql/functions/aggregates/#sum)
|
||||
- [Selectors](/influxdb/version/query-data/influxql/functions/selectors/)
|
||||
- [BOTTOM()](/influxdb/version/query-data/influxql/functions/selectors/#bottom)
|
||||
- [FIRST()](/influxdb/version/query-data/influxql/functions/selectors/#first)
|
||||
- [LAST()](/influxdb/version/query-data/influxql/functions/selectors/#last)
|
||||
- [MAX()](/influxdb/version/query-data/influxql/functions/selectors/#max)
|
||||
- [MIN()](/influxdb/version/query-data/influxql/functions/selectors/#min)
|
||||
- [PERCENTILE()](/influxdb/version/query-data/influxql/functions/selectors/#percentile)
|
||||
- [SAMPLE()](/influxdb/version/query-data/influxql/functions/selectors/#sample)
|
||||
- [TOP()](/influxdb/version/query-data/influxql/functions/selectors/#top)
|
||||
- [Transformations](/influxdb/version/query-data/influxql/functions/transformations/)
|
||||
- [ABS()](/influxdb/version/query-data/influxql/functions/transformations/#abs)
|
||||
- [ACOS()](/influxdb/version/query-data/influxql/functions/transformations/#acos)
|
||||
- [ASIN()](/influxdb/version/query-data/influxql/functions/transformations/#asin)
|
||||
- [ATAN()](/influxdb/version/query-data/influxql/functions/transformations/#atan)
|
||||
- [ATAN2()](/influxdb/version/query-data/influxql/functions/transformations/#atan2)
|
||||
- [CEIL()](/influxdb/version/query-data/influxql/functions/transformations/#ceil)
|
||||
- [COS()](/influxdb/version/query-data/influxql/functions/transformations/#cos)
|
||||
- [CUMULATIVE_SUM()](/influxdb/version/query-data/influxql/functions/transformations/#cumulative_sum)
|
||||
- [DERIVATIVE()](/influxdb/version/query-data/influxql/functions/transformations/#derivative)
|
||||
- [DIFFERENCE()](/influxdb/version/query-data/influxql/functions/transformations/#difference)
|
||||
- [ELAPSED()](/influxdb/version/query-data/influxql/functions/transformations/#elapsed)
|
||||
- [EXP()](/influxdb/version/query-data/influxql/functions/transformations/#exp)
|
||||
- [FLOOR()](/influxdb/version/query-data/influxql/functions/transformations/#floor)
|
||||
- [HISTOGRAM()](/influxdb/version/query-data/influxql/functions/transformations/#histogram)
|
||||
- [LN()](/influxdb/version/query-data/influxql/functions/transformations/#ln)
|
||||
- [LOG()](/influxdb/version/query-data/influxql/functions/transformations/#log)
|
||||
- [LOG2()](/influxdb/version/query-data/influxql/functions/transformations/#log2)
|
||||
- [LOG10()](/influxdb/version/query-data/influxql/functions/transformations/#log10)
|
||||
- [MOVING_AVERAGE()](/influxdb/version/query-data/influxql/functions/transformations/#moving_average)
|
||||
- [NON_NEGATIVE_DERIVATIVE()](/influxdb/version/query-data/influxql/functions/transformations/#non_negative_derivative)
|
||||
- [NON_NEGATIVE_DIFFERENCE()](/influxdb/version/query-data/influxql/functions/transformations/#non_negative_difference)
|
||||
- [POW()](/influxdb/version/query-data/influxql/functions/transformations/#pow)
|
||||
- [ROUND()](/influxdb/version/query-data/influxql/functions/transformations/#round)
|
||||
- [SIN()](/influxdb/version/query-data/influxql/functions/transformations/#sin)
|
||||
- [SQRT()](/influxdb/version/query-data/influxql/functions/transformations/#sqrt)
|
||||
- [TAN()](/influxdb/version/query-data/influxql/functions/transformations/#tan)
|
||||
- [Technical analysis](/influxdb/version/query-data/influxql/functions/technical-analysis/)
|
||||
- (Predictive analysis) [HOLT_WINTERS()](/influxdb/version/query-data/influxql/functions/technical-analysis/#holt_winters)
|
||||
- [CHANDE_MOMENTUM_OSCILLATOR()](/influxdb/version/query-data/influxql/functions/technical-analysis/#chande_momentum_oscillator)
|
||||
- [EXPONENTIAL_MOVING_AVERAGE()](/influxdb/version/query-data/influxql/functions/technical-analysis/#exponential_moving_average)
|
||||
- [DOUBLE_EXPONENTIAL_MOVING_AVERAGE()](/influxdb/version/query-data/influxql/functions/technical-analysis/#double_exponential_moving_average)
|
||||
- [KAUFMANS_EFFICIENCY_RATIO()](/influxdb/version/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/version/query-data/influxql/functions/technical-analysis/#triple_exponential_moving_average)
|
||||
- [TRIPLE_EXPONENTIAL_DERIVATIVE()](/influxdb/version/query-data/influxql/functions/technical-analysis/#triple_exponential_derivative)
|
||||
- [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.
|
||||
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)
|
||||
- [DISTINCT()](#distinct)
|
||||
|
@ -16,7 +16,7 @@ Each aggregate function below covers **syntax** including parameters to pass to
|
|||
|
||||
## 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
|
||||
|
||||
|
@ -26,15 +26,15 @@ SELECT COUNT( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE_
|
|||
|
||||
`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)`
|
||||
|
||||
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/)`
|
||||
|
||||
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
|
||||
|
||||
|
@ -119,8 +119,8 @@ name: h2o_feet
|
|||
|
||||
## DISTINCT()
|
||||
|
||||
Returns the list of unique [field values](/influxdb/v2/reference/glossary/#field-value).
|
||||
Supports all field value [data types](/influxdb/v2/reference/glossary/#data-type).
|
||||
Returns the list of unique [field values](/influxdb/version/reference/glossary/#field-value).
|
||||
Supports all field value [data types](/influxdb/version/reference/glossary/#data-type).
|
||||
|
||||
InfluxQL supports nesting `DISTINCT()` with [`COUNT()`](#count).
|
||||
|
||||
|
@ -132,7 +132,7 @@ SELECT DISTINCT( [ <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE_c
|
|||
|
||||
`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
|
||||
|
||||
|
@ -187,10 +187,10 @@ name: h2o_feet
|
|||
|
||||
## 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 %}}
|
||||
`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 %}}
|
||||
|
||||
### 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`.
|
||||
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`).
|
||||
|
||||
`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/)`
|
||||
|
||||
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(*)`
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
`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
|
||||
[limit](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)
|
||||
[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/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals) results into 12-minute intervals, and
|
||||
[limit](/influxdb/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||
the number of results returned to one.
|
||||
|
||||
```sql
|
||||
|
@ -341,7 +341,7 @@ name: h2o_feet
|
|||
|
||||
## 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
|
||||
|
||||
|
@ -350,14 +350,14 @@ SELECT MEAN( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE_c
|
|||
```
|
||||
|
||||
`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/)
|
||||
|
||||
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(*)`
|
||||
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
|
||||
|
||||
|
@ -422,13 +422,13 @@ name: h2o_feet
|
|||
{{% 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
|
||||
[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
|
||||
[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.
|
||||
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
|
||||
[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.
|
||||
|
||||
```sql
|
||||
|
@ -451,10 +451,10 @@ tags: location=coyote_creek
|
|||
|
||||
## 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:** `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 %}}
|
||||
|
||||
### Syntax
|
||||
|
@ -465,15 +465,15 @@ SELECT MEDIAN( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE
|
|||
|
||||
`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/)`
|
||||
|
||||
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(*)`
|
||||
|
||||
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
|
||||
|
||||
|
@ -537,13 +537,13 @@ name: h2o_feet
|
|||
{{% 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
|
||||
[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
|
||||
[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.
|
||||
Then [fill](/influxdb/v2/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/)
|
||||
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.
|
||||
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/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||
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
|
||||
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()
|
||||
|
||||
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:** `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 %}}
|
||||
|
||||
### Syntax
|
||||
|
@ -579,15 +579,15 @@ SELECT MODE( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE_c
|
|||
|
||||
`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/)`
|
||||
|
||||
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(*)`
|
||||
|
||||
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
|
||||
|
||||
|
@ -653,12 +653,12 @@ name: h2o_feet
|
|||
{{% 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
|
||||
[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
|
||||
[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.
|
||||
Then [limits](/influxdb/influxdb/v2/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
|
||||
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/version/query-data/influxql/explore-data
|
||||
#the-offset-and-soffset-clauses) the series returned by one.
|
||||
|
||||
```sql
|
||||
|
@ -681,7 +681,7 @@ tags: location=santa_monica
|
|||
|
||||
## 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
|
||||
|
||||
|
@ -691,15 +691,15 @@ SELECT SPREAD( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE
|
|||
|
||||
`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/)`
|
||||
|
||||
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(*)`
|
||||
|
||||
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
|
||||
|
||||
|
@ -766,14 +766,14 @@ name: h2o_feet
|
|||
{{% 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
|
||||
[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
|
||||
[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.
|
||||
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
|
||||
ts](/influxdb/v2/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.
|
||||
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/version/query-data/influxql/explore-data/limit-and-slimit/) the series returned by one.
|
||||
|
||||
```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
|
||||
|
@ -795,7 +795,7 @@ tags: location=santa_monica
|
|||
|
||||
## 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
|
||||
|
||||
|
@ -805,15 +805,15 @@ SELECT STDDEV( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE
|
|||
|
||||
`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/)`
|
||||
|
||||
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(*)`
|
||||
|
||||
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
|
||||
|
||||
|
@ -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" %}}
|
||||
|
||||
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
|
||||
[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.
|
||||
Then [fill](/influxdb/v2/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/)
|
||||
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.
|
||||
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/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||
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
|
||||
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()
|
||||
|
||||
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
|
||||
|
||||
|
@ -914,15 +914,15 @@ SELECT SUM( [ * | <field_key> | /<regular_expression>/ ] ) FROM_clause [WHERE_cl
|
|||
|
||||
`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/)`
|
||||
|
||||
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(*)`
|
||||
|
||||
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
|
||||
|
||||
|
@ -986,12 +986,12 @@ name: h2o_feet
|
|||
{{% 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
|
||||
[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
|
||||
[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.
|
||||
Then [fill](/influxdb/v2/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/)
|
||||
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/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||
the number of points and series returned to four and one.
|
||||
|
||||
```sql
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
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.
|
||||
|
||||
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)
|
||||
- [FIRST()](#first)
|
||||
|
@ -15,7 +15,7 @@ Each selector function below covers **syntax**, including parameters to pass to
|
|||
|
||||
## 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:** `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)`
|
||||
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)`
|
||||
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)`
|
||||
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
|
||||
|
||||
|
@ -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" %}}
|
||||
|
||||
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
|
||||
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" %}}
|
||||
|
||||
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
|
||||
[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
|
||||
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: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.
|
||||
See [Issue 1](#bottom-with-a-group-by-time-clause) in the section below for a
|
||||
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
|
||||
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.
|
||||
`GROUP BY time()` queries with the `BOTTOM()` function behave differently;
|
||||
they maintain the timestamp of the original data point.
|
||||
|
@ -199,7 +199,7 @@ name: h2o_feet
|
|||
|
||||
## 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
|
||||
|
||||
|
@ -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.
|
||||
|
||||
`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(*)`
|
||||
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)`
|
||||
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
|
||||
|
||||
|
@ -303,12 +303,12 @@ name: h2o_feet
|
|||
{{% 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`
|
||||
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
|
||||
[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.
|
||||
Then [fill](/influxdb/v2/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/)
|
||||
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/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||
the number of points and series returned to four and one.
|
||||
|
||||
```sql
|
||||
|
@ -327,7 +327,7 @@ tags: location=coyote_creek
|
|||
| 2019-08-18T00:12:00Z | 8.320 |
|
||||
| 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 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()
|
||||
|
||||
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
|
||||
|
||||
|
@ -346,18 +346,18 @@ SELECT LAST(<field_key>)[,<tag_key(s)>|<field_keys(s)>] FROM_clause [WHERE_claus
|
|||
```
|
||||
|
||||
`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/)`
|
||||
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(*)`
|
||||
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)`
|
||||
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
|
||||
|
||||
|
@ -442,12 +442,12 @@ name: h2o_feet
|
|||
{{% 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`
|
||||
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
|
||||
[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.
|
||||
Then [fill](/influxdb/v2/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/)
|
||||
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/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||
the number of points and series returned to four and one.
|
||||
|
||||
```sql
|
||||
|
@ -466,7 +466,7 @@ tags: location=coyote_creek
|
|||
| 2019-08-18T00:12:00Z | 8.225 |
|
||||
| 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 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()
|
||||
|
||||
Returns the greatest [field value](/influxdb/v2/reference/glossary/#field-value).
|
||||
Returns the greatest [field value](/influxdb/version/reference/glossary/#field-value).
|
||||
|
||||
### Syntax
|
||||
|
||||
|
@ -485,18 +485,18 @@ SELECT MAX(<field_key>)[,<tag_key(s)>|<field__key(s)>] FROM_clause [WHERE_clause
|
|||
```
|
||||
|
||||
`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/)`
|
||||
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(*)`
|
||||
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)`
|
||||
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
|
||||
|
||||
|
@ -581,12 +581,12 @@ name: h2o_feet
|
|||
{{% 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
|
||||
[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
|
||||
[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.
|
||||
Then [fill](/influxdb/v2/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/)
|
||||
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/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||
the number of points and series returned to four and one.
|
||||
|
||||
```sql
|
||||
|
@ -605,7 +605,7 @@ tags: location=coyote_creek
|
|||
| 2019-08-18T00:12:00Z | 8.320 |
|
||||
| 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 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()
|
||||
|
||||
Returns the lowest [field value](/influxdb/v2/reference/glossary/#field-value).
|
||||
Returns the lowest [field value](/influxdb/version/reference/glossary/#field-value).
|
||||
|
||||
### Syntax
|
||||
|
||||
|
@ -624,18 +624,18 @@ SELECT MIN(<field_key>)[,<tag_key(s)>|<field_key(s)>] FROM_clause [WHERE_clause]
|
|||
```
|
||||
|
||||
`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/)`
|
||||
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(*)`
|
||||
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)`
|
||||
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
|
||||
|
||||
|
@ -719,12 +719,12 @@ name: h2o_feet
|
|||
{{% 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
|
||||
[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
|
||||
[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.
|
||||
Then [fill](/influxdb/v2/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/)
|
||||
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/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||
the number of points and series returned to four and one.
|
||||
|
||||
```sql
|
||||
|
@ -743,7 +743,7 @@ tags: location=coyote_creek
|
|||
| 2019-08-18T00:12:00Z | 8.225 |
|
||||
| 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 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()
|
||||
|
||||
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
|
||||
|
||||
|
@ -762,19 +762,19 @@ SELECT PERCENTILE(<field_key>, <N>)[,<tag_key(s)>|<field_key(s)>] FROM_clause [W
|
|||
```
|
||||
|
||||
`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)`
|
||||
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)`
|
||||
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)`
|
||||
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.
|
||||
`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
|
||||
|
||||
|
@ -861,10 +861,10 @@ name: h2o_feet
|
|||
{{% 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
|
||||
`water_level` field in the [time range](/influxdb/v2/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.
|
||||
Then [fill](/influxdb/v2/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/)
|
||||
`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/version/query-data/influxql/explore-data/group-by/#group-by-time-intervals) results into 24-minute intervals.
|
||||
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/version/query-data/influxql/explore-data/limit-and-slimit/)
|
||||
the number of points returned to two.
|
||||
|
||||
```sql
|
||||
|
@ -880,7 +880,7 @@ name: h2o_feet
|
|||
| 2019-08-17T23:36:00Z | 2.398 |
|
||||
| 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`.
|
||||
|
||||
{{% /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(<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).
|
||||
|
||||
## 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.
|
||||
|
||||
### Syntax
|
||||
|
@ -907,19 +907,19 @@ SELECT SAMPLE(<field_key>, <N>)[,<tag_key(s)>|<field_key(s)>] FROM_clause [WHERE
|
|||
```
|
||||
|
||||
`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)`
|
||||
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)`
|
||||
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)`
|
||||
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.
|
||||
`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
|
||||
|
||||
|
@ -1011,9 +1011,9 @@ name: h2o_feet
|
|||
{{% 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
|
||||
[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
|
||||
[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.
|
||||
|
||||
```sql
|
||||
|
@ -1029,7 +1029,7 @@ name: h2o_feet
|
|||
| 2019-08-18T00:12:00Z | 2.343 |
|
||||
| 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
|
||||
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
|
||||
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.
|
||||
`GROUP BY time()` queries with the `SAMPLE()` function behave differently;
|
||||
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()
|
||||
|
||||
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
|
||||
|
||||
|
@ -1084,15 +1084,15 @@ SELECT TOP( <field_key>[,<tag_key(s)>],<N> )[,<tag_key(s)>|<field_key(s)>] FROM_
|
|||
```
|
||||
|
||||
`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)`
|
||||
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)`
|
||||
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:** `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" %}}
|
||||
|
||||
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
|
||||
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" %}}
|
||||
|
||||
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
|
||||
[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
|
||||
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: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.
|
||||
|
||||
{{% /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
|
||||
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.
|
||||
`GROUP BY time()` queries with the `TOP()` function behave differently;
|
||||
they maintain the timestamp of the original data point.
|
||||
|
@ -1261,7 +1261,7 @@ name: h2o_feet
|
|||
<!--
|
||||
##### 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)`.
|
||||
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.
|
||||
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
|
||||
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.
|
||||
|
||||
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):
|
||||
- [HOLT_WINTERS()](#holt_winters)
|
||||
|
@ -22,9 +22,9 @@ predict and forecast future values.
|
|||
|
||||
### 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.
|
||||
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.
|
||||
Requires an InfluxQL function and the `GROUP BY time()` clause to ensure that
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
the length of time that occurs between each peak and trough in the `water_level` data.
|
||||
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
|
||||
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.
|
||||
<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
|
||||
|
||||
|
@ -231,46 +231,46 @@ CHANDE_MOMENTUM_OSCILLATOR([ * | <field_key> | /regular_expression/ ], <period>[
|
|||
- (Optional) [warmup_type](#warmup_type)
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
a 9-value hold period, and the `none` warmup type.
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
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()
|
||||
|
||||
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.
|
||||
|
||||
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>
|
||||
|
||||
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 `EXPONENTIAL_MOVING_AVERAGE()` 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 `EXPONENTIAL_MOVING_AVERAGE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||
|
||||
### Basic syntax
|
||||
|
||||
|
@ -279,35 +279,35 @@ EXPONENTIAL_MOVING_AVERAGE([ * | <field_key> | /regular_expression/ ], <period>[
|
|||
```
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
a 9-value hold period, and the `exponential` warmup type.
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
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
|
||||
|
||||
|
@ -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.
|
||||
<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).
|
||||
To use `DOUBLE_EXPONENTIAL_MOVING_AVERAGE()` 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 `DOUBLE_EXPONENTIAL_MOVING_AVERAGE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||
|
||||
### Basic syntax
|
||||
|
||||
|
@ -335,35 +335,35 @@ DOUBLE_EXPONENTIAL_MOVING_AVERAGE([ * | <field_key> | /regular_expression/ ], <p
|
|||
```
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
a 9-value hold period, and the `exponential` warmup type.
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
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
|
||||
|
||||
|
@ -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.
|
||||
<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).
|
||||
To use `KAUFMANS_EFFICIENCY_RATIO()` 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 `KAUFMANS_EFFICIENCY_RATIO()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||
|
||||
### Basic syntax
|
||||
|
||||
|
@ -393,35 +393,35 @@ KAUFMANS_EFFICIENCY_RATIO([ * | <field_key> | /regular_expression/ ], <period>[,
|
|||
```
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
a 10-value hold period.
|
||||
|
||||
`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
|
||||
and the default hold period.
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
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:**
|
||||
|
||||
|
@ -438,8 +438,8 @@ This trend-following indicator can be used to identify the overall trend,
|
|||
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>
|
||||
|
||||
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 `KAUFMANS_ADAPTIVE_MOVING_AVERAGE()` 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 `KAUFMANS_ADAPTIVE_MOVING_AVERAGE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||
|
||||
### Basic syntax
|
||||
|
||||
|
@ -448,35 +448,35 @@ KAUFMANS_ADAPTIVE_MOVING_AVERAGE([ * | <field_key> | /regular_expression/ ], <pe
|
|||
```
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
and a 10-value hold period.
|
||||
|
||||
`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
|
||||
and the default hold period.
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
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:**
|
||||
- [period](#period)
|
||||
|
@ -492,8 +492,8 @@ a [double exponential moving average](#double_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>
|
||||
|
||||
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 `TRIPLE_EXPONENTIAL_MOVING_AVERAGE()` 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 `TRIPLE_EXPONENTIAL_MOVING_AVERAGE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||
|
||||
### Basic syntax
|
||||
|
||||
|
@ -502,35 +502,35 @@ TRIPLE_EXPONENTIAL_MOVING_AVERAGE([ * | <field_key> | /regular_expression/ ], <p
|
|||
```
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
a 9-value hold period, and the `exponential` warmup type.
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
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:**
|
||||
- [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
|
||||
used as a momentum indicator.
|
||||
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.
|
||||
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.
|
||||
|
@ -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.
|
||||
<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).
|
||||
To use `TRIPLE_EXPONENTIAL_DERIVATIVE()` 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 `TRIPLE_EXPONENTIAL_DERIVATIVE()` with a `GROUP BY time()` clause, see [Advanced syntax](/influxdb/version/query-data/influxql/functions/transformations/#advanced-syntax).
|
||||
|
||||
### Basic syntax
|
||||
|
||||
|
@ -566,44 +566,44 @@ TRIPLE_EXPONENTIAL_DERIVATIVE([ * | <field_key> | /regular_expression/ ], <perio
|
|||
```
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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,
|
||||
a 10-value hold period, and the `exponential` warmup type.
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
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()
|
||||
|
||||
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>
|
||||
|
||||
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
|
||||
|
||||
|
@ -612,35 +612,35 @@ RELATIVE_STRENGTH_INDEX([ * | <field_key> | /regular_expression/ ], <period>[, <
|
|||
```
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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,
|
||||
a 10-value hold period, and the `exponential` warmup type.
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
{{% 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 %}}
|
||||
|
||||
`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
|
||||
and the default hold period and warmup type.
|
||||
|
||||
`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
|
||||
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:**
|
||||
- [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
|
||||
|
||||
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.
|
||||
|
||||
### Syntax
|
||||
|
@ -17,9 +17,9 @@ INSERT [INTO <database>[.<retention-policy>]] <line-protocol>
|
|||
|
||||
- The `INTO` clause is optional.
|
||||
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
|
||||
[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
|
||||
|
||||
|
@ -41,7 +41,7 @@ INSERT INTO mydb example-m,tag1=value1 field1=1i 1640995200000000000
|
|||
|
||||
#### 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
|
||||
> USE mydb
|
||||
|
@ -50,7 +50,7 @@ The following example uses the [InfluxQL shell](/influxdb/v2/tools/influxql-shel
|
|||
|
||||
## 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
|
||||
|
||||
|
@ -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>]
|
||||
```
|
||||
|
||||
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 %}}
|
||||
- `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
|
||||
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 %}}
|
||||
|
||||
### Examples
|
||||
|
@ -115,7 +115,7 @@ DELETE FROM device_data WHERE "device" = 'sensor15" and time >= '2024-01-01T12:0
|
|||
|
||||
## 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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
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:
|
||||
|
||||
Perform a mathematical operation on a wildcard.
|
||||
|
@ -303,5 +303,5 @@ SELECT mean(10 * "value") FROM "cpu"
|
|||
```
|
||||
|
||||
{{% 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 %}}
|
||||
|
|
|
@ -78,7 +78,7 @@ to the underlying data source, so data returned by the
|
|||
previous function loads into memory.
|
||||
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.
|
||||
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.
|
||||
|
@ -153,10 +153,10 @@ data
|
|||
## Balance time range and data precision
|
||||
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,
|
||||
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.
|
||||
|
||||
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
|
||||
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