WIP adding list code examples to flux query guides

pull/921/head
Scott Anderson 2020-04-02 13:25:00 -06:00
parent cdc1706528
commit a0c6ddc7c1
6 changed files with 72 additions and 22 deletions

View File

@ -1,17 +1,22 @@
---
title: Group data in InfluxDB with Flux
list_title: Group data
list_title: Group
description: >
This guide walks through grouping data with Flux by providing examples and
illustrating how data is shaped throughout the process.
Use the [`group()` function](/v2.0/reference/flux/stdlib/built-in/transformations/group)
to group data with common values in specific columns.
v2.0/tags: [group]
menu:
v2_0:
name: Group data
name: Group
parent: Query with Flux
weight: 202
aliases:
- /v2.0/query-data/guides/group-data/
- /v2.0/query-data/guides/group-data/
list_code_example: |
```js
data
|> group(columns: ["cpu", "host"], mode: "by")
```
---
With Flux, you can group data by any column in your queried data set.

View File

@ -1,15 +1,28 @@
---
title: Create histograms with Flux
list_title: Create histograms
description: This guide walks through using the `histogram()` function to create cumulative histograms with Flux.
list_title: Histograms
description: >
Use the [`histogram()` function](/v2.0/reference/flux/stdlib/built-in/transformations/histogram/)
to create cumulative histograms with Flux.
v2.0/tags: [histogram]
menu:
v2_0:
name: Create histograms
name: Histograms
parent: Query with Flux
weight: 210
aliases:
- /v2.0/query-data/guides/histograms/
- /v2.0/query-data/guides/histograms/
list_code_example: |
```js
data
|> histogram(
column: "_value",
upperBoundColumn: "le",
countColumn: "_value",
bins: [50.0, 75.0, 90.0],
normalize: false)
)
```
---
Histograms provide valuable insight into the distribution of your data.

View File

@ -2,7 +2,9 @@
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.
description: >
Use the [`map()` function](/v2.0/reference/flux/stdlib/built-in/transformations/map)
to remap column values and apply mathematic operations.
v2.0/tags: [math, flux]
menu:
v2_0:
@ -10,7 +12,12 @@ menu:
parent: Query with Flux
weight: 205
aliases:
- /v2.0/query-data/guides/mathematic-operations/
- /v2.0/query-data/guides/mathematic-operations/
list_code_example: |
```js
data
|> map(fn: (r) => ({ r with _value: r._value * r._value }))
```
---
[Flux](/v2.0/reference/flux), InfluxData's data scripting and query language,

View File

@ -2,7 +2,7 @@
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.
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.
weight: 201
@ -10,6 +10,16 @@ menu:
v2_0:
parent: Query with Flux
v2.0/tags: [query, select, where]
list_code_example: |
```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"
)
```
---
Use the [`filter()` function](/v2.0/reference/flux/stdlib/built-in/transformations/filter/)

View File

@ -1,22 +1,32 @@
---
title: Sort and limit data with Flux
seotitle: Sort and limit data in InfluxDB with Flux
list_title: Sort and limit data
list_title: Sort and limit
description: >
This guide walks through sorting and limiting data with Flux and outlines how
it shapes your data in the process.
Use the [`sort()`function](/v2.0/reference/flux/stdlib/built-in/transformations/sort)
to order records within each table by specific columns and the
[`limit()` function](/v2.0/reference/flux/stdlib/built-in/transformations/limit)
to limit the number of records in output tables to a fixed number, `n`.
v2.0/tags: [sort, limit]
menu:
v2_0:
name: Sort and limit data
name: Sort and limit
parent: Query with Flux
weight: 203
aliases:
- /v2.0/query-data/guides/sort-limit/
- /v2.0/query-data/guides/sort-limit/
list_code_example: |
```js
data
|> sort(columns: ["host", "_value"])
|> limit(n: 10)
```
---
The [`sort()`function](/v2.0/reference/flux/stdlib/built-in/transformations/sort)
orders the records within each table.
Use the [`sort()`function](/v2.0/reference/flux/stdlib/built-in/transformations/sort)
to order records within each table by specific columns and the
[`limit()` function](/v2.0/reference/flux/stdlib/built-in/transformations/limit)
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:

View File

@ -1,18 +1,23 @@
---
title: Window and aggregate data with Flux
seotitle: Window and aggregate data in InfluxDB with Flux
list_title: Window & aggregate data
list_title: Window & aggregate
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 & aggregate data
name: Window & aggregate
parent: Query with Flux
weight: 204
v2.0/tags: [flux, aggregates]
aliases:
- /v2.0/query-data/guides/window-aggregate/
- /v2.0/query-data/guides/window-aggregate/
list_code_example: |
```js
data
|> aggregateWindow(every: 5m, fn: mean)
```
---
A common operation performed with time series data is grouping data into windows of time,