Skip to content

Commit 545dd69

Browse files
committed
updates
1 parent 64c0855 commit 545dd69

File tree

14 files changed

+1035
-244
lines changed

14 files changed

+1035
-244
lines changed

docs/reference/data-analysis/aggregations/search-aggregations-bucket-adjacency-matrix-aggregation.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
navigation_title: "Adjacency matrix"
3-
mapped_pages:
4-
- https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-adjacency-matrix-aggregation.html
53
---
64

75
# Adjacency matrix aggregation [search-aggregations-bucket-adjacency-matrix-aggregation]
@@ -88,6 +86,12 @@ The response contains buckets with document counts for each filter and combinati
8886
}
8987
```
9088

89+
% TESTRESPONSE[s/"took": 9/"took": $body.took/]
90+
91+
% TESTRESPONSE[s/"_shards": \.\.\./"_shards": $body._shards/]
92+
93+
% TESTRESPONSE[s/"hits": \.\.\./"hits": $body.hits/]
94+
9195

9296
## Parameters [adjacency-matrix-agg-params]
9397

@@ -96,9 +100,9 @@ The response contains buckets with document counts for each filter and combinati
96100

97101
::::{dropdown} Properties of `filters`
98102
`<filter>`
99-
: (Required, [Query DSL object](/reference/query-languages/querydsl.md)) Query used to filter documents. The key is the filter name.
103+
: (Required, [Query DSL object](query-dsl.md)) Query used to filter documents. The key is the filter name.
100104

101-
At least one filter is required. The total number of filters cannot exceed the [`indices.query.bool.max_clause_count`](/reference/elasticsearch/configuration-reference/search-settings.md#indices-query-bool-max-clause-count) setting. See [Filter limits](#adjacency-matrix-agg-filter-limits).
105+
At least one filter is required. The total number of filters cannot exceed the [`indices.query.bool.max_clause_count`](search-settings.md#indices-query-bool-max-clause-count) setting. See [Filter limits](search-aggregations-bucket-adjacency-matrix-aggregation.md#adjacency-matrix-agg-filter-limits).
102106

103107

104108
::::

docs/reference/data-analysis/aggregations/search-aggregations-bucket-autodatehistogram-aggregation.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
---
22
navigation_title: "Auto-interval date histogram"
3-
mapped_pages:
4-
- https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-autodatehistogram-aggregation.html
53
---
64

75
# Auto-interval date histogram aggregation [search-aggregations-bucket-autodatehistogram-aggregation]
86

97

10-
A multi-bucket aggregation similar to the [Date histogram](/reference/data-analysis/aggregations/search-aggregations-bucket-datehistogram-aggregation.md) except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided indicating the number of buckets needed and the interval of the buckets is automatically chosen to best achieve that target. The number of buckets returned will always be less than or equal to this target number.
8+
A multi-bucket aggregation similar to the [Date histogram](search-aggregations-bucket-datehistogram-aggregation.md) except instead of providing an interval to use as the width of each bucket, a target number of buckets is provided indicating the number of buckets needed and the interval of the buckets is automatically chosen to best achieve that target. The number of buckets returned will always be less than or equal to this target number.
119

1210
The buckets field is optional, and will default to 10 buckets if not specified.
1311

@@ -29,12 +27,14 @@ POST /sales/_search?size=0
2927
}
3028
```
3129

30+
% TEST[setup:sales]
31+
3232
## Keys [_keys]
3333

3434
Internally, a date is represented as a 64 bit number representing a timestamp in milliseconds-since-the-epoch. These timestamps are returned as the bucket `key`s. The `key_as_string` is the same timestamp converted to a formatted date string using the format specified with the `format` parameter:
3535

36-
::::{tip}
37-
If no `format` is specified, then it will use the first date [format](/reference/elasticsearch/mapping-reference/mapping-date-format.md) specified in the field mapping.
36+
::::{tip}
37+
If no `format` is specified, then it will use the first date [format](mapping-date-format.md) specified in the field mapping.
3838
::::
3939

4040

@@ -55,7 +55,9 @@ POST /sales/_search?size=0
5555
}
5656
```
5757

58-
1. Supports expressive date [format pattern](/reference/data-analysis/aggregations/search-aggregations-bucket-daterange-aggregation.md#date-format-pattern)
58+
% TEST[setup:sales]
59+
60+
1. Supports expressive date [format pattern](search-aggregations-bucket-daterange-aggregation.md#date-format-pattern)
5961

6062

6163
Response:
@@ -88,6 +90,8 @@ Response:
8890
}
8991
```
9092

93+
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
94+
9195

9296
## Intervals [_intervals]
9397

@@ -183,6 +187,8 @@ UTC is used if no time zone is specified, three 1-hour buckets are returned star
183187
}
184188
```
185189

190+
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
191+
186192
If a `time_zone` of `-01:00` is specified, then midnight starts at one hour before midnight UTC:
187193

188194
```console
@@ -200,6 +206,8 @@ GET my-index-000001/_search?size=0
200206
}
201207
```
202208

209+
% TEST[continued]
210+
203211
Now three 1-hour buckets are still returned but the first bucket starts at 11:00pm on 30 September 2015 since that is the local time for the bucket in the specified time zone.
204212

205213
```console-result
@@ -230,10 +238,12 @@ Now three 1-hour buckets are still returned but the first bucket starts at 11:00
230238
}
231239
```
232240

241+
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
242+
233243
1. The `key_as_string` value represents midnight on each day in the specified time zone.
234244

235245

236-
::::{warning}
246+
::::{warning}
237247
When using time zones that follow DST (daylight savings time) changes, buckets close to the moment when those changes happen can have slightly different sizes than neighbouring buckets. For example, consider a DST start in the `CET` time zone: on 27 March 2016 at 2am, clocks were turned forward 1 hour to 3am local time. If the result of the aggregation was daily buckets, the bucket covering that day will only hold data for 23 hours instead of the usual 24 hours for other buckets. The same is true for shorter intervals like e.g. 12h. Here, we will have only a 11h bucket on the morning of 27 March when the DST shift happens.
238248
::::
239249

@@ -269,6 +279,8 @@ POST /sales/_search?size=0
269279
}
270280
```
271281

282+
% TEST[setup:sales]
283+
272284

273285
## Missing value [_missing_value]
274286

@@ -291,6 +303,8 @@ POST /sales/_search?size=0
291303
}
292304
```
293305

306+
% TEST[setup:sales]
307+
294308
1. Documents without a value in the `publish_date` field will fall into the same bucket as documents that have the value `2000-01-01`.
295309

296310

docs/reference/data-analysis/aggregations/search-aggregations-bucket-iprange-aggregation.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
---
22
navigation_title: "IP range"
3-
mapped_pages:
4-
- https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-iprange-aggregation.html
53
---
64

75
# IP range aggregation [search-aggregations-bucket-iprange-aggregation]
86

97

10-
Just like the dedicated [date](/reference/data-analysis/aggregations/search-aggregations-bucket-daterange-aggregation.md) range aggregation, there is also a dedicated range aggregation for IP typed fields:
8+
Just like the dedicated [date](search-aggregations-bucket-daterange-aggregation.md) range aggregation, there is also a dedicated range aggregation for IP typed fields:
119

1210
Example:
1311

@@ -31,6 +29,8 @@ GET /ip_addresses/_search
3129
}
3230
```
3331

32+
% TEST[setup:iprange]
33+
3434
Response:
3535

3636
```console-result
@@ -56,6 +56,8 @@ Response:
5656
}
5757
```
5858

59+
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
60+
5961
IP ranges can also be defined as CIDR masks:
6062

6163
$$$ip-range-cidr-example$$$
@@ -78,6 +80,8 @@ GET /ip_addresses/_search
7880
}
7981
```
8082

83+
% TEST[setup:iprange]
84+
8185
Response:
8286

8387
```console-result
@@ -105,6 +109,8 @@ Response:
105109
}
106110
```
107111

112+
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
113+
108114
## Keyed Response [_keyed_response_3]
109115

110116
Setting the `keyed` flag to `true` will associate a unique string key with each bucket and return the ranges as a hash rather than an array:
@@ -130,6 +136,8 @@ GET /ip_addresses/_search
130136
}
131137
```
132138

139+
% TEST[setup:iprange]
140+
133141
Response:
134142

135143
```console-result
@@ -153,6 +161,8 @@ Response:
153161
}
154162
```
155163

164+
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
165+
156166
It is also possible to customize the key for each range:
157167

158168
$$$ip-range-keyed-customized-keys-example$$$
@@ -176,6 +186,8 @@ GET /ip_addresses/_search
176186
}
177187
```
178188

189+
% TEST[setup:iprange]
190+
179191
Response:
180192

181193
```console-result
@@ -199,4 +211,6 @@ Response:
199211
}
200212
```
201213

214+
% TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
215+
202216

docs/reference/data-analysis/aggregations/search-aggregations-bucket-multi-terms-aggregation.md

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,52 @@
11
---
22
navigation_title: "Multi Terms"
3-
mapped_pages:
4-
- https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-multi-terms-aggregation.html
53
---
64

75
# Multi Terms aggregation [search-aggregations-bucket-multi-terms-aggregation]
86

97

10-
A multi-bucket value source based aggregation where buckets are dynamically built - one per unique set of values. The multi terms aggregation is very similar to the [`terms aggregation`](/reference/data-analysis/aggregations/search-aggregations-bucket-terms-aggregation.md#search-aggregations-bucket-terms-aggregation-order), however in most cases it will be slower than the terms aggregation and will consume more memory. Therefore, if the same set of fields is constantly used, it would be more efficient to index a combined key for this fields as a separate field and use the terms aggregation on this field.
11-
12-
The multi_term aggregations are the most useful when you need to sort by a number of document or a metric aggregation on a composite key and get top N results. If sorting is not required and all values are expected to be retrieved using nested terms aggregation or [`composite aggregations`](/reference/data-analysis/aggregations/search-aggregations-bucket-composite-aggregation.md) will be a faster and more memory efficient solution.
8+
A multi-bucket value source based aggregation where buckets are dynamically built - one per unique set of values. The multi terms aggregation is very similar to the [`terms aggregation`](search-aggregations-bucket-terms-aggregation.md#search-aggregations-bucket-terms-aggregation-order), however in most cases it will be slower than the terms aggregation and will consume more memory. Therefore, if the same set of fields is constantly used, it would be more efficient to index a combined key for this fields as a separate field and use the terms aggregation on this field.
9+
10+
The multi_term aggregations are the most useful when you need to sort by a number of document or a metric aggregation on a composite key and get top N results. If sorting is not required and all values are expected to be retrieved using nested terms aggregation or [`composite aggregations`](search-aggregations-bucket-composite-aggregation.md) will be a faster and more memory efficient solution.
11+
12+
%
13+
% [source,js]
14+
% --------------------------------------------------
15+
% PUT /products
16+
% {
17+
% "mappings": {
18+
% "properties": {
19+
% "genre": {
20+
% "type": "keyword"
21+
% },
22+
% "product": {
23+
% "type": "keyword"
24+
% },
25+
% "quantity": {
26+
% "type": "integer"
27+
% }
28+
% }
29+
% }
30+
% }
31+
%
32+
% POST /products/_bulk?refresh
33+
% {"index":{"_id":0}}
34+
% {"genre": "rock", "product": "Product A", "quantity": 4}
35+
% {"index":{"_id":1}}
36+
% {"genre": "rock", "product": "Product A", "quantity": 5}
37+
% {"index":{"_id":2}}
38+
% {"genre": "rock", "product": "Product B", "quantity": 1}
39+
% {"index":{"_id":3}}
40+
% {"genre": "jazz", "product": "Product B", "quantity": 10}
41+
% {"index":{"_id":4}}
42+
% {"genre": "electronic", "product": "Product B", "quantity": 3}
43+
% {"index":{"_id":5}}
44+
% {"genre": "electronic"}
45+
%
46+
% -------------------------------------------------
47+
% // NOTCONSOLE
48+
% // TESTSETUP
49+
%
1350

1451
Example:
1552

@@ -32,7 +69,9 @@ GET /products/_search
3269
}
3370
```
3471

35-
1. `multi_terms` aggregation can work with the same field types as a [`terms aggregation`](/reference/data-analysis/aggregations/search-aggregations-bucket-terms-aggregation.md#search-aggregations-bucket-terms-aggregation-order) and supports most of the terms aggregation parameters.
72+
% TEST[s/_search/_search\?filter_path=aggregations/]
73+
74+
1. `multi_terms` aggregation can work with the same field types as a [`terms aggregation`](search-aggregations-bucket-terms-aggregation.md#search-aggregations-bucket-terms-aggregation-order) and supports most of the terms aggregation parameters.
3675

3776

3877
Response:
@@ -83,6 +122,8 @@ Response:
83122
}
84123
```
85124

125+
% TESTRESPONSE[s/\.\.\.//]
126+
86127
1. an upper bound of the error on the document counts for each term, see <<search-aggregations-bucket-multi-terms-aggregation-approximate-counts,below>
87128
2. when there are lots of unique terms, Elasticsearch only returns the top terms; this number is the sum of the document counts for all buckets that are not part of the response
88129
3. the list of the top buckets.
@@ -93,7 +134,7 @@ By default, the `multi_terms` aggregation will return the buckets for the top te
93134

94135
## Aggregation Parameters [search-aggregations-bucket-multi-terms-aggregation-parameters]
95136

96-
The following parameters are supported. See [`terms aggregation`](/reference/data-analysis/aggregations/search-aggregations-bucket-terms-aggregation.md#search-aggregations-bucket-terms-aggregation-order) for more detailed explanation of these parameters.
137+
The following parameters are supported. See [`terms aggregation`](search-aggregations-bucket-terms-aggregation.md#search-aggregations-bucket-terms-aggregation-order) for more detailed explanation of these parameters.
97138

98139
size
99140
: Optional. Defines how many term buckets should be returned out of the overall terms list. Defaults to 10.
@@ -149,6 +190,8 @@ GET /products/_search
149190
}
150191
```
151192

193+
% TEST[s/_search/_search\?filter_path=aggregations/]
194+
152195
Response:
153196

154197
```console-result
@@ -189,6 +232,8 @@ Response:
189232
}
190233
```
191234

235+
% TESTRESPONSE[s/\.\.\.//]
236+
192237

193238
## Missing value [_missing_value_3]
194239

@@ -217,6 +262,8 @@ GET /products/_search
217262
}
218263
```
219264

265+
% TEST[s/_search/_search\?filter_path=aggregations/]
266+
220267
Response:
221268

222269
```console-result
@@ -273,13 +320,15 @@ Response:
273320
}
274321
```
275322

323+
% TESTRESPONSE[s/\.\.\.//]
324+
276325
1. Documents without a value in the `product` field will fall into the same bucket as documents that have the value `Product Z`.
277326

278327

279328

280329
## Mixing field types [_mixing_field_types]
281330

282-
::::{warning}
331+
::::{warning}
283332
When aggregating on multiple indices the type of the aggregated field may not be the same in all indices. Some types are compatible with each other (`integer` and `long` or `float` and `double`) but when the types are a mix of decimal and non-decimal number the terms aggregation will promote the non-decimal numbers to decimal numbers. This can result in a loss of precision in the bucket values.
284333
::::
285334

@@ -321,6 +370,8 @@ GET /products/_search
321370
}
322371
```
323372

373+
% TEST[s/_search/_search\?filter_path=aggregations/]
374+
324375
```console-result
325376
{
326377
...
@@ -379,4 +430,6 @@ GET /products/_search
379430
}
380431
```
381432

433+
% TESTRESPONSE[s/\.\.\.//]
434+
382435

0 commit comments

Comments
 (0)