<commit_before>---
title: WindowNode
description: WindowNode caches data within a moving time range.
note: Auto generated by tickdoc

menu:
  kapacitor_1_5:
    name: WindowNode
    identifier: window_node
    weight: 340
    parent: nodes
---

The `window` node caches data within a moving time range.
The `period` property of `window` defines the time range covered by `window`.

The `every` property of `window` defines the frequency at which the window
is emitted to the next node in the pipeline.

The `align` property of `window` defines how to align the window edges.
(By default, the edges are defined relative to the first data point the `window`
node receives.)

Example:


```js
stream
  |window()
    .period(10m)
    .every(5m)
  |httpOut('recent')
```

This example emits the last `10 minute` period every `5 minutes` to the pipeline's `httpOut` node.
Because `every` is less than `period`, each time the window is emitted it contains `5 minutes` of
new data and `5 minutes` of the previous period's data.

> **NOTE:** Because no `align` property is defined, the `window` edge is defined relative to the first data point.


### Constructor

| Chaining Method | Description |
|:---------|:---------|
| **window&nbsp;(&nbsp;)** | Create a new node that windows the stream by time.  |

### Property Methods

| Setters | Description |
|:---|:---|
| **[align](#align)&nbsp;(&nbsp;)** | If the `align` property is not used to modify the `window` node, then the window alignment is assumed to start at the time of the first data point it receives. If `align` property is set, the window time edges will be truncated to the `every` property (For example, if a data point's time is 12:06 and the `every` property is `5m` then the data point's window will range from 12:05 to 12:10).  |
| **[every](#every)&nbsp;(&nbsp;`value`&nbsp;`time.Duration`)** | How often the current window is emitted into the pipeline. If equal to zero, then every new point will emit the current window.  |
| **[everyCount](#everycount)&nbsp;(&nbsp;`value`&nbsp;`int64`)** | EveryCount determines how often the window is emitted based on the count of points. A value of 1 means that every new point will emit the window.  |
| **[fillPeriod](#fillperiod)&nbsp;(&nbsp;)** | FillPeriod instructs the WindowNode to wait till the period has elapsed before emitting the first batch. This only applies if the period is greater than the every value.  |
| **[period](#period)&nbsp;(&nbsp;`value`&nbsp;`time.Duration`)** | The period, or length in time, of the window.  |
| **[periodCount](#periodcount)&nbsp;(&nbsp;`value`&nbsp;`int64`)** | PeriodCount is the number of points per window.  |
| **[quiet](#quiet)&nbsp;(&nbsp;)** | Suppress all error logging events from this node.  |



### Chaining Methods
[Alert](#alert),
[Barrier](#barrier),
[Bottom](#bottom),
[ChangeDetect](#changedetect),
[Combine](#combine),
[Count](#count),
[CumulativeSum](#cumulativesum),
[Deadman](#deadman),
[Default](#default),
[Delete](#delete),
[Derivative](#derivative),
[Difference](#difference),
[Distinct](#distinct),
[Ec2Autoscale](#ec2autoscale),
[Elapsed](#elapsed),
[Eval](#eval),
[First](#first),
[Flatten](#flatten),
[GroupBy](#groupby),
[HoltWinters](#holtwinters),
[HoltWintersWithFit](#holtwinterswithfit),
[HttpOut](#httpout),
[HttpPost](#httppost),
[InfluxDBOut](#influxdbout),
[Join](#join),
[K8sAutoscale](#k8sautoscale),
[KapacitorLoopback](#kapacitorloopback),
[Last](#last),
[Log](#log),
[Max](#max),
[Mean](#mean),
[Median](#median),
[Min](#min),
[Mode](#mode),
[MovingAverage](#movingaverage),
[Percentile](#percentile),
[Sample](#sample),
[Shift](#shift),
[Sideload](#sideload),
[Spread](#spread),
[StateCount](#statecount),
[StateDuration](#stateduration),
[Stats](#stats),
[Stddev](#stddev),
[Sum](#sum),
[SwarmAutoscale](#swarmautoscale),
[Top](#top),
[Union](#union),
[Where](#where),
[Window](#window)

---

## Properties

Property methods modify state on the calling node.
They do not add another node to the pipeline, and always return a reference to the calling node.
Property methods are marked using the `.` operator.


### Align

If the `align` property is not used to modify the `window` node, then the
window alignment is assumed to start at the time of the first data point it receives.
If `align` property is set, the window time edges
will be truncated to the `every` property (For example, if a data point's time
is 12:06 and the `every` property is `5m` then the data point's window will range
from 12:05 to 12:10).


```js
window.align()
```

<a class="top" href="javascript:document.getElementsByClassName('article-heading')[0].scrollIntoView();" title="top"><span class="icon arrow-up"></span></a>


### Every

How often the current window is emitted into the pipeline.
If equal to zero, then every new point will emit the current window.


```js
window.every(value time.Duration)
```

<a class="top" href="javascript:document.getElementsByClassName('article-heading')[0].scrollIntoView();" title="top"><span class="icon arrow-up"></span></a>


### EveryCount

EveryCount determines how often the window is emitted based on the count of points.
A value of 1 means that every new point will emit the window.<commit_msg>note about using window.align() to prevent dups<commit_after>---
title: WindowNode
description: WindowNode caches data within a moving time range.
note: Auto generated by tickdoc

menu:
  kapacitor_1_5:
    name: WindowNode
    identifier: window_node
    weight: 340
    parent: nodes
---

The `window` node caches data within a moving time range.
The `period` property of `window` defines the time range covered by `window`.

The `every` property of `window` defines the frequency at which the window
is emitted to the next node in the pipeline.

The `align` property of `window` defines how to align the window edges.
(By default, the edges are defined relative to the first data point the `window`
node receives.)

Example:


```js
stream
  |window()
    .period(10m)
    .every(5m)
  |httpOut('recent')
```

This example emits the last `10 minute` period every `5 minutes` to the pipeline's `httpOut` node.
Because `every` is less than `period`, each time the window is emitted it contains `5 minutes` of
new data and `5 minutes` of the previous period's data.

> **NOTE:** Because no `align` property is defined, the `window` edge is defined relative to the first data point.


### Constructor

| Chaining Method | Description |
|:---------|:---------|
| **window&nbsp;(&nbsp;)** | Create a new node that windows the stream by time.  |

### Property Methods

| Setters | Description |
|:---|:---|
| **[align](#align)&nbsp;(&nbsp;)** | If the `align` property is not used to modify the `window` node, then the window alignment is assumed to start at the time of the first data point it receives. If `align` property is set, the window time edges will be truncated to the `every` property (For example, if a data point's time is 12:06 and the `every` property is `5m` then the data point's window will range from 12:05 to 12:10).  |
| **[every](#every)&nbsp;(&nbsp;`value`&nbsp;`time.Duration`)** | How often the current window is emitted into the pipeline. If equal to zero, then every new point will emit the current window.  |
| **[everyCount](#everycount)&nbsp;(&nbsp;`value`&nbsp;`int64`)** | EveryCount determines how often the window is emitted based on the count of points. A value of 1 means that every new point will emit the window.  |
| **[fillPeriod](#fillperiod)&nbsp;(&nbsp;)** | FillPeriod instructs the WindowNode to wait till the period has elapsed before emitting the first batch. This only applies if the period is greater than the every value.  |
| **[period](#period)&nbsp;(&nbsp;`value`&nbsp;`time.Duration`)** | The period, or length in time, of the window.  |
| **[periodCount](#periodcount)&nbsp;(&nbsp;`value`&nbsp;`int64`)** | PeriodCount is the number of points per window.  |
| **[quiet](#quiet)&nbsp;(&nbsp;)** | Suppress all error logging events from this node.  |



### Chaining Methods
[Alert](#alert),
[Barrier](#barrier),
[Bottom](#bottom),
[ChangeDetect](#changedetect),
[Combine](#combine),
[Count](#count),
[CumulativeSum](#cumulativesum),
[Deadman](#deadman),
[Default](#default),
[Delete](#delete),
[Derivative](#derivative),
[Difference](#difference),
[Distinct](#distinct),
[Ec2Autoscale](#ec2autoscale),
[Elapsed](#elapsed),
[Eval](#eval),
[First](#first),
[Flatten](#flatten),
[GroupBy](#groupby),
[HoltWinters](#holtwinters),
[HoltWintersWithFit](#holtwinterswithfit),
[HttpOut](#httpout),
[HttpPost](#httppost),
[InfluxDBOut](#influxdbout),
[Join](#join),
[K8sAutoscale](#k8sautoscale),
[KapacitorLoopback](#kapacitorloopback),
[Last](#last),
[Log](#log),
[Max](#max),
[Mean](#mean),
[Median](#median),
[Min](#min),
[Mode](#mode),
[MovingAverage](#movingaverage),
[Percentile](#percentile),
[Sample](#sample),
[Shift](#shift),
[Sideload](#sideload),
[Spread](#spread),
[StateCount](#statecount),
[StateDuration](#stateduration),
[Stats](#stats),
[Stddev](#stddev),
[Sum](#sum),
[SwarmAutoscale](#swarmautoscale),
[Top](#top),
[Union](#union),
[Where](#where),
[Window](#window)

---

## Properties

Property methods modify state on the calling node.
They do not add another node to the pipeline, and always return a reference to the calling node.
Property methods are marked using the `.` operator.


### Align

If the `align` property is not used to modify the `window` node, then the
window alignment is assumed to start at the time of the first data point it receives.
If `align` property is set, the window time edges
will be truncated to the `every` property (For example, if a data point's time
is 12:06 and the `every` property is `5m` then the data point's window will range
from 12:05 to 12:10).


```js
window.align()
```
> Note: When ingesting data at irregular intervals, we recommend using `window.align()` to prevent duplicate values with the same timestamp or unexpected additional values.

<a class="top" href="javascript:document.getElementsByClassName('article-heading')[0].scrollIntoView();" title="top"><span class="icon arrow-up"></span></a>


### Every

How often the current window is emitted into the pipeline.
If equal to zero, then every new point will emit the current window.


```js
window.every(value time.Duration)
```

<a class="top" href="javascript:document.getElementsByClassName('article-heading')[0].scrollIntoView();" title="top"><span class="icon arrow-up"></span></a>


### EveryCount

EveryCount determines how often the window is emitted based on the count of points.
A value of 1 means that every new point will emit the window.
{'fraction_non_alphanumeric': 0.1492621486981859, 'fraction_numerical': 0.009587367233762571, 'mean_word_length': 5.543665436654367, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7238583', 'n_tokens_mistral': 3396, 'n_tokens_neox': 3098, 'n_words': 1218}