Merge branch 'master' into geo/strict-explanation

pull/813/head
Scott Anderson 2020-03-10 15:21:21 -06:00
commit 18a9cbf543
34 changed files with 641 additions and 60 deletions

View File

@ -509,6 +509,38 @@ The following options are available:
{{< ui-message color="green" text="The message displayed in the notification.">}}
```
### Flexbox-formatted content blocks
CSS Flexbox formatting lets you create columns in article content that adjust and
flow based on the viewable width.
In article content, this helps if you have narrow tables that could be displayed
side-by-side, rather than stacked vertically.
Use the `{{< flex >}}` shortcode to create the Flexbox wrapper.
Use the `{{% flex-content %}}` shortcode to identify each column content block.
```md
{{< flex >}}
{{% flex-content %}}
Column 1
{{% /flex-content %}}
{{% flex-content %}}
Column 2
{{% /flex-content %}}
{{< /flex >}}
```
`{{% flex-content %}}` has an optional width argument that determines the maximum
width of the column.
```md
{{% flex-content "half" %}}
```
The following options are available:
- half _(Default)_
- third
- quarter
### Reference content
The InfluxDB documentation is "task-based," meaning content primarily focuses on
what a user is **doing**, not what they are **using**.

View File

@ -104,6 +104,7 @@
"article/cloud",
"article/enterprise",
"article/feedback",
"article/flex",
"article/lists",
"article/note",
"article/pagination-btns",

View File

@ -0,0 +1,24 @@
/////////////////////////// Flex Content Blocks ///////////////////////////
.flex-wrapper {
display: flex;
flex-wrap: wrap;
}
.flex-container {
margin-right: 1rem;
&.half { width: calc(50% - 1rem); }
&.third { width: calc(33.33% - 1rem); }
&.quarter { width: calc(25% - 1rem); }
}
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// MEDIA QUERIES ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
@include media(small) {
.flex-container {
&.half, &.third { width: calc(100% - 1rem); }
&.quarter { width: calc(50% - 1rem); }
}
}

View File

@ -45,4 +45,4 @@ Guidelines used to estimate costs for default configurations:
- **Professional**. For teams monitoring multiple disparate systems or use cases.
- **Enterprise**. For teams monitoring multiple domains and use cases accessing a variety of dashboards.
5. Adjust the default configuration values to match your number of devices, plugins, metrics, and so on. The **Projected Usage** costs are automatically updated as you adjust your configuration.
6. Click **Get started with InfluxDB Cloud** [to get started](https://v2.docs.influxdata.com/v2.0/cloud/get-started/).
6. Click **Get started with InfluxDB Cloud** [to get started](/v2.0/cloud/get-started/).

View File

@ -2,7 +2,7 @@
title: Execute queries
seotitle: Different ways to query InfluxDB
description: There are multiple ways to query data from InfluxDB including the InfluxDB UI, CLI, and API.
weight: 102
weight: 103
menu:
v2_0:
name: Execute queries

View File

@ -0,0 +1,36 @@
---
title: Query data with Flux
description: Guides that walk through both common and complex queries and use cases for Flux.
weight: 102
v2.0/tags: [flux, query]
menu:
v2_0:
name: Query with Flux
parent: Query data
alias:
- /v2.0/query-data/guides/
---
The following guides walk through both common and complex queries and use cases for Flux.
{{% note %}}
#### Example data variable
Many of the examples provided in the following guides use a `data` variable,
which represents a basic query that filters data by measurement and field.
`data` is defined as:
```js
data = from(bucket: "example-bucket")
|> range(start: -1h)
|> filter(fn: (r) =>
r._measurement == "example-measurement" and
r._field == "example-field"
)
```
{{% /note %}}
## Flux query guides
---
{{< children >}}

View File

@ -1,15 +1,18 @@
---
title: Query using conditional logic
seotitle: Query using conditional logic in Flux
list_title: Use conditional logic
description: >
This guide describes how to use Flux conditional expressions, such as `if`,
`else`, and `then`, to query and transform data.
v2.0/tags: [conditionals, flux]
menu:
v2_0:
name: Query using conditionals
parent: How-to guides
weight: 209
name: Use conditional logic
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/conditional-logic/
---
Flux provides `if`, `then`, and `else` conditional expressions that allow for powerful and flexible Flux queries.

View File

@ -0,0 +1,67 @@
---
title: Query cumulative sum
seotitle: Query cumulative sum in Flux
list_title: Cumulative sum
description: >
Use the `cumulativeSum()` function to calculate a running total of values.
weight: 210
menu:
v2_0:
parent: Query with Flux
name: Query the cumulative sum
v2.0/tags: [query, cumulative sum]
---
Use the [`cumulativeSum()` function](/v2.0/reference/flux/stdlib/built-in/transformations/cumulativesum/)
to calculate a running total of values.
`cumulativeSum` sums the values of subsequent records and returns each row updated with the summed total.
{{< flex >}}
{{% flex-content "half" %}}
**Given the following input table:**
| _time | _value |
| ----- |:------:|
| 0001 | 1 |
| 0002 | 2 |
| 0003 | 1 |
| 0004 | 3 |
{{% /flex-content %}}
{{% flex-content "half" %}}
**`cumulativeSum()` returns:**
| _time | _value |
| ----- |:------:|
| 0001 | 1 |
| 0002 | 3 |
| 0003 | 4 |
| 0004 | 7 |
{{% /flex-content %}}
{{< /flex >}}
{{% note %}}
The examples below use the [example data variable](/v2.0/query-data/flux/#example-data-variable).
{{% /note %}}
##### Calculate the running total of values
```js
data
|> cumulativeSum()
```
## Use cumulativeSum() with aggregateWindow()
[`aggregateWindow()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/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](/v2.0/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()`,
then calculate the running total of the aggregate values with `cumulativeSum()`.
<!-- -->
```js
data
|> aggregateWindow(every: 5m, fn: sum)
|> cumulativeSum()
```

View File

@ -5,8 +5,10 @@ v2.0/tags: [functions, custom, flux]
menu:
v2_0:
name: Create custom functions
parent: How-to guides
weight: 208
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/custom-functions/
---
Flux's functional syntax allows for custom functions.

View File

@ -7,6 +7,8 @@ menu:
name: Custom aggregate functions
parent: Create custom functions
weight: 301
aliases:
- /v2.0/query-data/guides/custom-functions/custom-aggregate/
---
To aggregate your data, use the Flux

View File

@ -8,8 +8,10 @@ v2.0/tags: [exists]
menu:
v2_0:
name: Check if a value exists
parent: How-to guides
weight: 209
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/exists/
---
Use the Flux `exists` operator to check if an object contains a key or if that

View File

@ -1,5 +1,6 @@
---
title: Group data in InfluxDB with Flux
list_title: Group data
description: >
This guide walks through grouping data with Flux by providing examples and
illustrating how data is shaped throughout the process.
@ -7,8 +8,10 @@ v2.0/tags: [group]
menu:
v2_0:
name: Group data
parent: How-to guides
weight: 203
parent: Query with Flux
weight: 202
aliases:
- /v2.0/query-data/guides/group-data/
---
With Flux, you can group data by any column in your queried data set.

View File

@ -1,12 +1,15 @@
---
title: Create histograms with Flux
list_title: Create histograms
description: This guide walks through using the `histogram()` function to create cumulative histograms with Flux.
v2.0/tags: [histogram]
menu:
v2_0:
name: Create histograms
parent: How-to guides
weight: 208
parent: Query with Flux
weight: 210
aliases:
- /v2.0/query-data/guides/histograms/
---
Histograms provide valuable insight into the distribution of your data.

View File

@ -1,13 +1,16 @@
---
title: Join data with Flux
seotitle: Join data in InfluxDB with Flux
list_title: Join data
description: This guide walks through joining data with Flux and outlines how it shapes your data in the process.
v2.0/tags: [join, flux]
menu:
v2_0:
name: Join data
parent: How-to guides
weight: 205
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/join/
---
The [`join()` function](/v2.0/reference/flux/stdlib/built-in/transformations/join) merges two or more

View File

@ -1,12 +1,15 @@
---
title: Manipulate timestamps with Flux
list_title: Manipulate timestamps
description: >
Use Flux to process and manipulate timestamps.
menu:
v2_0:
name: Manipulate timestamps
parent: How-to guides
weight: 209
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/manipulate-timestamps/
---
Every point stored in InfluxDB has an associated timestamp.

View File

@ -1,13 +1,16 @@
---
title: Transform data with mathematic operations
seotitle: Transform data with mathematic operations in Flux
list_title: Transform data with math
description: This guide describes how to use Flux to transform data with mathematic operations.
v2.0/tags: [math, flux]
menu:
v2_0:
name: Transform data with math
parent: How-to guides
weight: 209
parent: Query with Flux
weight: 205
aliases:
- /v2.0/query-data/guides/mathematic-operations/
---
[Flux](/v2.0/reference/flux), InfluxData's data scripting and query language,

View File

@ -0,0 +1,147 @@
---
title: Find median values
seotitle: Find median values in Flux
list_title: Median
description: >
Use the `median()` function to return a value representing the `0.5` quantile
(50th percentile) or median of input data.
weight: 210
menu:
v2_0:
parent: Query with Flux
name: Find the median
v2.0/tags: [query, median]
related:
- /v2.0/query-data/flux/percentile-quantile/
---
Use the [`median()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/median/)
to return a value representing the `0.5` quantile (50th percentile) or median of input data.
## Select a method for calculating the median
Select one of the following methods to calculate the median:
- [estimate_tdigest](#estimate-tdigest)
- [exact_mean](#exact-mean)
- [exact_selector](#exact-selector)
### estimate_tdigest
**(Default)** An aggregate method that uses a [t-digest data structure](https://github.com/tdunning/t-digest)
to compute an accurate `0.5` quantile estimate on large data sources.
Output tables consist of a single row containing the calculated median.
{{< flex >}}
{{% flex-content %}}
**Given the following input table:**
| _time | _value |
| ----- |:------:|
| 0001 | 1.0 |
| 0002 | 1.0 |
| 0003 | 2.0 |
| 0004 | 3.0 |
{{% /flex-content %}}
{{% flex-content %}}
**`estimate_tdigest` returns:**
| _value |
|:------:|
| 1.5 |
{{% /flex-content %}}
{{< /flex >}}
### exact_mean
An aggregate method that takes the average of the two points closest to the `0.5` quantile value.
Output tables consist of a single row containing the calculated median.
{{< flex >}}
{{% flex-content %}}
**Given the following input table:**
| _time | _value |
| ----- |:------:|
| 0001 | 1.0 |
| 0002 | 1.0 |
| 0003 | 2.0 |
| 0004 | 3.0 |
{{% /flex-content %}}
{{% flex-content %}}
**`exact_mean` returns:**
| _value |
|:------:|
| 1.5 |
{{% /flex-content %}}
{{< /flex >}}
### exact_selector
A selector method that returns the data point for which at least 50% of points are less than.
Output tables consist of a single row containing the calculated median.
{{< flex >}}
{{% flex-content %}}
**Given the following input table:**
| _time | _value |
| ----- |:------:|
| 0001 | 1.0 |
| 0002 | 1.0 |
| 0003 | 2.0 |
| 0004 | 3.0 |
{{% /flex-content %}}
{{% flex-content %}}
**`exact_selector` returns:**
| _time | _value |
| ----- |:------:|
| 0002 | 1.0 |
{{% /flex-content %}}
{{< /flex >}}
{{% note %}}
The examples below use the [example data variable](/v2.0/query-data/flux/#example-data-variable).
{{% /note %}}
## Find the value that represents the median
Use the default method, `"estimate_tdigest"`, to return all rows in a table that
contain values in the 50th percentile of data in the table.
```js
data
|> median()
```
## Find the average of values closest to the median
Use the `exact_mean` method to return a single row per input table containing the
average of the two values closest to the mathematical median of data in the table.
```js
data
|> median(method: "exact_mean")
```
## Find the point with the median value
Use the `exact_selector` method to return a single row per input table containing the
value that 50% of values in the table are less than.
```js
data
|> median(method: "exact_selector")
```
## Use median() with aggregateWindow()
[`aggregateWindow()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/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](/v2.0/process-data/common-tasks/downsample-data/).
To specify the [median calculation method](#median-calculation-methods) in `aggregateWindow()`, use the
[full function syntax](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow/#specify-parameters-of-the-aggregate-function):
```js
data
|> aggregateWindow(
every: 5m,
fn: (tables=<-, column) => tables |> median(method: "exact_selector")
)
```

View File

@ -6,8 +6,10 @@ v2.0/tags: [states, monitor, flux]
menu:
v2_0:
name: Monitor states
parent: How-to guides
weight: 209
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/monitor-states/
---
Flux helps you monitor states in your metrics and events:
@ -24,7 +26,7 @@ If you're just getting started with Flux queries, check out the following:
## Find how long a state persists
1. Use the [`stateDuration()`](/v2.0/reference/flux/stdlib/built-in/transformations/stateduration/) function to calculate how long a column value has remained the same value (or state). Include the following information:
- **Column to search:** any tag key, tag value, field key, field value, or measurement.
- **Value:** the value (or state) to search for in the specified column.
- **State duration column:** a new column to store the state duration─the length of time that the specified value persists.
@ -83,7 +85,7 @@ _time _value door_closed
```js
|> stateCount
(fn: (r) =>
(fn: (r) =>
r._column_to_search == "value_to_search_for",
column: "state_count"`
)
@ -148,9 +150,9 @@ Detect state changes with the `monitor.stateChanges()` function. To use the `mon
{{< nav-icon "alerts" >}}
2. If you haven't already, [create a check](/v2.0/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](/v2.0/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?
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:
- `fromLevel` (optional; by default, this is set to `any`)

View File

@ -0,0 +1,163 @@
---
title: Find percentile and quantile values
seotitle: Query percentile and quantile values in Flux
list_title: Percentile & quantile
description: >
Use the `quantile()` function to return all values within the `q` quantile or
percentile of input data.
weight: 210
menu:
v2_0:
parent: Query with Flux
name: Query percentiles & quantiles
v2.0/tags: [query, percentile, quantile]
related:
- /v2.0/query-data/flux/query-median/
---
Use the [`quantile()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/quantile/)
to return a value representing the `q` quantile or percentile of input data.
## Percentile versus quantile
Percentiles and quantiles are very similar, differing only in the number used to calculate return values.
A percentile is calculated using numbers between `0` and `100`.
A quantile is calculated using numbers between `0.0` and `1.0`.
For example, the **`0.5` quantile** is the same as the **50th percentile**.
## Select a method for calculating the quantile
Select one of the following methods to calculate the quantile:
- [estimate_tdigest](#estimate-tdigest)
- [exact_mean](#exact-mean)
- [exact_selector](#exact-selector)
### estimate_tdigest
**(Default)** An aggregate method that uses a [t-digest data structure](https://github.com/tdunning/t-digest)
to compute a quantile estimate on large data sources.
Output tables consist of a single row containing the calculated quantile.
If calculating the `0.5` quantile or 50th percentile:
{{< flex >}}
{{% flex-content %}}
**Given the following input table:**
| _time | _value |
| ----- |:------:|
| 0001 | 1.0 |
| 0002 | 1.0 |
| 0003 | 2.0 |
| 0004 | 3.0 |
{{% /flex-content %}}
{{% flex-content %}}
**`estimate_tdigest` returns:**
| _value |
|:------:|
| 1.5 |
{{% /flex-content %}}
{{< /flex >}}
### exact_mean
An aggregate method that takes the average of the two points closest to the quantile value.
Output tables consist of a single row containing the calculated quantile.
If calculating the `0.5` quantile or 50th percentile:
{{< flex >}}
{{% flex-content %}}
**Given the following input table:**
| _time | _value |
| ----- |:------:|
| 0001 | 1.0 |
| 0002 | 1.0 |
| 0003 | 2.0 |
| 0004 | 3.0 |
{{% /flex-content %}}
{{% flex-content %}}
**`exact_mean` returns:**
| _value |
|:------:|
| 1.5 |
{{% /flex-content %}}
{{< /flex >}}
### exact_selector
A selector method that returns the data point for which at least `q` points are less than.
Output tables consist of a single row containing the calculated quantile.
If calculating the `0.5` quantile or 50th percentile:
{{< flex >}}
{{% flex-content %}}
**Given the following input table:**
| _time | _value |
| ----- |:------:|
| 0001 | 1.0 |
| 0002 | 1.0 |
| 0003 | 2.0 |
| 0004 | 3.0 |
{{% /flex-content %}}
{{% flex-content %}}
**`exact_selector` returns:**
| _time | _value |
| ----- |:------:|
| 0002 | 1.0 |
{{% /flex-content %}}
{{< /flex >}}
{{% note %}}
The examples below use the [example data variable](/v2.0/query-data/flux/#example-data-variable).
{{% /note %}}
## Find the value representing the 99th percentile
Use the default method, `"estimate_tdigest"`, to return all rows in a table that
contain values in the 99th percentile of data in the table.
```js
data
|> quantile(q: 0.99)
```
## Find the average of values closest to the quantile
Use the `exact_mean` method to return a single row per input table containing the
average of the two values closest to the mathematical quantile of data in the table.
For example, to calculate the `0.99` quantile:
```js
data
|> quantile(q: 0.99, method: "exact_mean")
```
## Find the point with the quantile value
Use the `exact_selector` method to return a single row per input table containing the
value that `q * 100`% of values in the table are less than.
For example, to calculate the `0.99` quantile:
```js
data
|> quantile(q: 0.99, method: "exact_selector")
```
## Use quantile() with aggregateWindow()
[`aggregateWindow()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/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](/v2.0/process-data/common-tasks/downsample-data/).
To specify the [quantile calculation method](#quantile-calculation-methods) in
`aggregateWindow()`, use the [full function syntax](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow/#specify-parameters-of-the-aggregate-function):
```js
data
|> aggregateWindow(
every: 5m,
fn: (tables=<-, column) =>
tables
|> quantile(q: 0.99, method: "exact_selector")
)
```

View File

@ -0,0 +1,67 @@
---
title: Query fields and tags
seotitle: Query fields and tags in InfluxDB using Flux
description: >
Use the `filter()` function to query data based on fields, tags, or any other column value.
`filter()` performs operations similar to the `SELECT` statement and the `WHERE`
clause in InfluxQL and other SQL-like query languages.
weight: 201
menu:
v2_0:
parent: Query with Flux
v2.0/tags: [query, select, where]
---
Use the [`filter()` function](/v2.0/reference/flux/stdlib/built-in/transformations/filter/)
to query data based on fields, tags, or any other column value.
`filter()` performs operations similar to the `SELECT` statement and the `WHERE`
clause in InfluxQL and other SQL-like query languages.
## The filter() function
`filter()` has an `fn` parameter that expects a [predicate function](/v2.0/reference/glossary/#predicate-function),
an anonymous function comprised of one or more [predicate expressions](/v2.0/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.
```js
// ...
|> filter(fn: (r) => r._measurement == "example-measurement" )
```
The `fn` predicate function requires an `r` argument, which represents each row
as `filter()` iterates over input data.
Key-value pairs in the row object represent columns and their values.
Use **dot notation** or **bracket notation** to reference specific column values in the predicate function.
Use [logical operators](/v2.0/reference/flux/language/operators/#logical-operators)
to chain multiple predicate expressions together.
```js
// Row object
r = {foo: "bar", baz: "quz"}
// Example predicate function
(r) => r.foo == "bar" and r["baz"] == "quz"
// Evaluation results
(r) => true and true
```
## Filter by fields and tags
The combination of [`from()`](/v2.0/reference/flux/stdlib/built-in/inputs/from),
[`range()`](/v2.0/reference/flux/stdlib/built-in/transformations/range),
and `filter()` represent the most basic Flux query:
1. Use `from()` to define your [bucket](/v2.0/reference/glossary/#bucket).
2. Use `range()` to limit query results by time.
3. Use `filter()` to identify what rows of data to output.
```js
from(bucket: "example-bucket")
|> range(start: -1h)
|> filter(fn: (r) =>
r._measurement == "example-measurement" and
r._field == "example-field" and
r.tag == "example-tag"
)
```

View File

@ -1,12 +1,15 @@
---
title: Use regular expressions in Flux
list_title: Use regular expressions
description: This guide walks through using regular expressions in evaluation logic in Flux functions.
v2.0/tags: [regex]
menu:
v2_0:
name: Use regular expressions
parent: How-to guides
weight: 210
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/regular-expressions/
---
Regular expressions (regexes) are incredibly powerful when matching patterns in large collections of data.

View File

@ -1,5 +1,6 @@
---
title: Extract scalar values in Flux
list_title: Extract scalar values
description: >
Use Flux stream and table functions to extract scalar values from Flux query output.
This lets you, for example, dynamically set variables using query results.
@ -7,10 +8,12 @@ menu:
v2_0:
name: Extract scalar values
parent: How-to guides
weight: 210
weight: 220
v2.0/tags: [scalar]
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/stream-table/
aliases:
- /v2.0/query-data/guides/scalar-values/
---
Use Flux [stream and table functions](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/)

View File

@ -1,6 +1,7 @@
---
title: Sort and limit data with Flux
seotitle: Sort and limit data in InfluxDB with Flux
list_title: Sort and limit data
description: >
This guide walks through sorting and limiting data with Flux and outlines how
it shapes your data in the process.
@ -8,8 +9,10 @@ v2.0/tags: [sort, limit]
menu:
v2_0:
name: Sort and limit data
parent: How-to guides
weight: 206
parent: Query with Flux
weight: 203
aliases:
- /v2.0/query-data/guides/sort-limit/
---
The [`sort()`function](/v2.0/reference/flux/stdlib/built-in/transformations/sort)

View File

@ -7,8 +7,10 @@ description: >
v2.0/tags: [query, flux, sql]
menu:
v2_0:
parent: How-to guides
weight: 207
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/sql/
---
The [Flux](/v2.0/reference/flux) `sql` package provides functions for working with SQL data sources.

View File

@ -1,15 +1,18 @@
---
title: Window and aggregate data with Flux
seotitle: Window and aggregate data in InfluxDB with Flux
list_title: Window & aggregate data
description: >
This guide walks through windowing and aggregating data with Flux and outlines
how it shapes your data in the process.
menu:
v2_0:
name: Window and aggregate data
parent: How-to guides
weight: 202
name: Window & aggregate data
parent: Query with Flux
weight: 204
v2.0/tags: [flux, aggregates]
aliases:
- /v2.0/query-data/guides/window-aggregate/
---
A common operation performed with time series data is grouping data into windows of time,

View File

@ -1,14 +0,0 @@
---
title: Flux how-to guides
description: Helpful guides that walk through both common and complex tasks and use cases for Flux.
weight: 103
v2.0/tags: [flux, query]
menu:
v2_0:
name: How-to guides
parent: Query data
---
The following guides walk through common query uses cases.
{{< children >}}

View File

@ -97,7 +97,7 @@ Function operators facilitate the creation of functions and control the flow of
---
_See [Custom functions](/v2.0/query-data/guides/custom-functions) for examples of function operators is use._
_See [Custom functions](/v2.0/query-data/flux/custom-functions) for examples of function operators is use._
---

View File

@ -708,6 +708,15 @@ A predicate expression compares two values and returns `true` or `false` based o
the relationship between the two values.
A predicate expression is comprised of a left operand, a comparison operator, and a right operand.
### predicate function
A Flux predicate function is an anonymous function that returns `true` or `false`
based on one or more [predicate expressions](#predicate-expression).
###### Example predicate function
```js
(r) => r.foo == "bar" and r.baz != "quz"
```
### process
A set of predetermined rules.
@ -919,7 +928,7 @@ Related entries: [bin](#bin)
### step-plot
In InfluxDB 1.x, a [step-plot graph](https://docs.influxdata.com/chronograf/v1.7/guides/visualization-types/#step-plot-graph) displays time series data in a staircase graph.
In InfluxDB 2.0, generate a similar graph using the step interpolation option for [line graphs](https://v2.docs.influxdata.com/v2.0/visualize-data/visualization-types/graph/#options).
In InfluxDB 2.0, generate a similar graph using the step interpolation option for [line graphs](/v2.0/visualize-data/visualization-types/graph/#options).
### stream
@ -988,7 +997,7 @@ Related entries: [function](#function)
A plugin-driven agent that collects, processes, aggregates, and writes metrics.
Related entries: [Automatically configure Telegraf](https://v2.docs.influxdata.com/v2.0/write-data/use-telegraf/auto-config/), [Manually configure Telegraf](https://v2.docs.influxdata.com/v2.0/write-data/use-telegraf/manual-config/), [Telegraf plugins](https://v2.docs.influxdata.com/v2.0/reference/telegraf-plugins/), [Use Telegraf to collect data](https://v2.docs.influxdata.com/v2.0/write-data/use-telegraf/), [View a Telegraf configuration](https://v2.docs.influxdata.com/v2.0/write-data/use-telegraf/auto-config/view-telegraf-config/)
Related entries: [Automatically configure Telegraf](/v2.0/write-data/use-telegraf/auto-config/), [Manually configure Telegraf](/v2.0/write-data/use-telegraf/manual-config/), [Telegraf plugins](/v2.0/reference/telegraf-plugins/), [Use Telegraf to collect data](/v2.0/write-data/use-telegraf/), [View a Telegraf configuration](/v2.0/write-data/use-telegraf/auto-config/view-telegraf-config/)
### time (data type)
@ -1017,12 +1026,12 @@ Related entries: [point](#point)
Tokens verify user and organization permissions in InfluxDB.
Related entries: [Create a token](https://v2.docs.influxdata.com/v2.0/security/tokens/create-token/).
Related entries: [Create a token](/v2.0/security/tokens/create-token/).
### tracing
By default, tracing is disabled in InfluxDB.
To enable tracing or set other InfluxDB configuration options, see [InfluxDB configuration options](https://v2.docs.influxdata.com/v2.0/reference/config-options/).
To enable tracing or set other InfluxDB configuration options, see [InfluxDB configuration options](/v2.0/reference/config-options/).
### transformation
@ -1106,4 +1115,4 @@ Related entries: [tsm](#tsm-time-structured-merge-tree)
### windowing
Grouping data based on specified time intervals.
For information about how to window in Flux, see [Window and aggregate data with Flux](https://v2.docs.influxdata.com/v2.0/query-data/guides/window-aggregate/).
For information about how to window in Flux, see [Window and aggregate data with Flux](/v2.0/query-data/flux/window-aggregate/).

View File

@ -162,11 +162,11 @@ A **point** includes the series key, a field value, and a timestamp. For example
## Bucket
All InfluxDB data is stored in a bucket. A **bucket** combines the concept of a database and a retention period (the duration of time that each data point persists). A bucket belongs to an organization. For more information about buckets, see [Manage buckets](https://v2.docs.influxdata.com/v2.0/organizations/buckets/).
All InfluxDB data is stored in a bucket. A **bucket** combines the concept of a database and a retention period (the duration of time that each data point persists). A bucket belongs to an organization. For more information about buckets, see [Manage buckets](/v2.0/organizations/buckets/).
## Organization
An InfluxDB **organization** is a workspace for a group of [users](/v2.0/users/). All [dashboards](/v2.0/visualize-data/dashboards/), [tasks](/v2.0/process-data/), buckets, and users belong to an organization. For more information about organizations, see [Manage organizations](https://v2.docs.influxdata.com/v2.0/organizations/).
An InfluxDB **organization** is a workspace for a group of [users](/v2.0/users/). All [dashboards](/v2.0/visualize-data/dashboards/), [tasks](/v2.0/process-data/), buckets, and users belong to an organization. For more information about organizations, see [Manage organizations](/v2.0/organizations/).
If you're just starting out, we recommend taking a look at the following guides:

View File

@ -16,7 +16,7 @@ InfluxDB 2.0 uses the following columnar table structure to store data:
- **Header row:** describes the data labels for each column in a row.
- **Data columns:** include the following columns: annotation, result, and table.
- **Data rows:** all rows that contain time series data. For details about the type of data stored in InfluxDB, see [InfluxDB data elements](/v2.0/reference/key-concepts/data-elements/).
- **Group keys** determine the contents of output tables in Flux by grouping records that share common values in specified columns. Learn more about [grouping your data with Flux](/v2.0/query-data/guides/group-data/).
- **Group keys** determine the contents of output tables in Flux by grouping records that share common values in specified columns. Learn more about [grouping your data with Flux](/v2.0/query-data/flux/group-data/).
For specifications on the InfluxDB 2.0 table structure, see [Tables](/v2.0/reference/syntax/annotated-csv/#tables).

View File

@ -34,7 +34,7 @@ See [Get started with Flux](/v2.0/query-data/get-started) to learn more about Fl
- Select a bucket to define your data source.
- 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](/v2.0/query-data/guides/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](/v2.0/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.

View File

@ -54,7 +54,7 @@ List all unique tag values for a specific tag in a specified bucket.
The example below lists all unique values of the `host` tag.
_**Flux package:** [InfluxDB v1](/v2.0/reference/flux/stdlib/influxdb-v1/)_
_**Flux functions:** [v1.measurements()](/v2.0/reference/flux/stdlib/influxdb-v1/measurements/)_
_**Flux functions:** [v1.tagValues()](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues/)_
```js
import "influxdata/influxdb/v1"

View File

@ -0,0 +1,5 @@
{{ $width := .Get 0 | default "half" }}
{{ $_hugo_config := `{ "version": 1 }` }}
<div class="flex-container {{ $width }}">
{{ .Inner }}
</div>

View File

@ -0,0 +1,4 @@
{{ $_hugo_config := `{ "version": 1 }` }}
<div class="flex-wrapper">
{{ .Inner }}
</div>