Skip to content

Commit dc17b09

Browse files
authored
[DOCS] Adds an example to change point aggregation (#94776) (#94786)
* [DOCS] Adds an example to change point aggregation. * [DOCS] Edits. (cherry picked from commit 0405a4d)
1 parent 9755710 commit dc17b09

File tree

1 file changed

+52
-9
lines changed

1 file changed

+52
-9
lines changed

docs/reference/aggregations/pipeline/change-point-aggregation.asciidoc

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,64 @@ The found change point type and its related values. Possible types:
7171
* `trend_change`: there is an overall trend change occurring at this point
7272
--
7373

74-
==== Response example
74+
==== Example
75+
76+
77+
The following example uses the Kibana sample data logs data set.
78+
79+
[source,js]
80+
--------------------------------------------------
81+
GET kibana_sample_data_logs/_search
82+
{
83+
"aggs": {
84+
"date":{ <1>
85+
"date_histogram": {
86+
"field": "@timestamp",
87+
"fixed_interval": "1d"
88+
},
89+
"aggs": {
90+
"avg": { <2>
91+
"avg": {
92+
"field": "bytes"
93+
}
94+
}
95+
}
96+
},
97+
"change_points_avg": { <3>
98+
"change_point": {
99+
"buckets_path": "date>avg" <4>
100+
}
101+
}
102+
}
103+
}
104+
--------------------------------------------------
105+
// NOTCONSOLE
106+
<1> A date histogram aggregation that creates buckets with one day long
107+
interval.
108+
<2> A sibling aggregation of the `date` aggregation that calculates the average
109+
value of the `bytes` field within every bucket.
110+
<3> The change point detection aggregation configuration object.
111+
<4> The path of the aggregation values to detect change points. In this case,
112+
the input of the change point aggregation is the value of `avg` which is a
113+
sibling aggregation of `date`.
114+
115+
116+
The request returns a response that is similar to the following:
117+
75118
[source,js]
76119
--------------------------------------------------
77-
"changes" : {
120+
"change_points_avg" : {
78121
"bucket" : {
79-
"key" : "2022-01-28T23:00:00.000Z", <1>
80-
"doc_count" : 48, <2>
81-
"ticket_price" : { <3>
82-
"value" : 1187.61083984375
122+
"key" : "2023-04-29T00:00:00.000Z", <1>
123+
"doc_count" : 329, <2>
124+
"avg" : { <3>
125+
"value" : 4737.209726443769
83126
}
84127
},
85128
"type" : { <4>
86-
"distribution_change" : {
87-
"p_value" : 0.023753965139433175, <5>
88-
"change_point" : 40 <6>
129+
"dip" : {
130+
"p_value" : 3.8999455212466465e-10, <5>
131+
"change_point" : 41 <6>
89132
}
90133
}
91134
}

0 commit comments

Comments
 (0)