[DOCS] Adding headers in TOC for aggregation docs. (#66604) (#66608)

This commit is contained in:
Adam Locke 2020-12-18 12:00:20 -05:00 committed by GitHub
parent 2620725297
commit 3b58f8fd5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 14 deletions

View File

@ -56,7 +56,7 @@ will be removed in the future.
================================== ==================================
[[calendar_intervals]] [[calendar_intervals]]
===== Calendar intervals ==== Calendar intervals
Calendar-aware intervals are configured with the `calendar_interval` parameter. Calendar-aware intervals are configured with the `calendar_interval` parameter.
You can specify calendar intervals using the unit name, such as `month`, or as a You can specify calendar intervals using the unit name, such as `month`, or as a
@ -173,7 +173,7 @@ POST /sales/_search?size=0
// NOTCONSOLE // NOTCONSOLE
[[fixed_intervals]] [[fixed_intervals]]
===== Fixed intervals ==== Fixed intervals
Fixed intervals are configured with the `fixed_interval` parameter. Fixed intervals are configured with the `fixed_interval` parameter.
@ -267,7 +267,7 @@ POST /sales/_search?size=0
// NOTCONSOLE // NOTCONSOLE
[[datehistogram-aggregation-notes]] [[datehistogram-aggregation-notes]]
===== Notes ==== Date histogram usage notes
In all cases, when the specified end time does not exist, the actual end time is In all cases, when the specified end time does not exist, the actual end time is
the closest available time after the specified end. the closest available time after the specified end.
@ -282,17 +282,17 @@ As always, rigorous testing, especially around time-change events, will ensure
that your time interval specification is that your time interval specification is
what you intend it to be. what you intend it to be.
WARNING: WARNING: To avoid unexpected results, all connected servers and clients must
To avoid unexpected results, all connected servers and clients must sync to a sync to a reliable network time service.
reliable network time service.
NOTE: fractional time values are not supported, but you can address this by NOTE: Fractional time values are not supported, but you can address this by
shifting to another time unit (e.g., `1.5h` could instead be specified as `90m`). shifting to another time unit (e.g., `1.5h` could instead be specified as `90m`).
NOTE: You can also specify time values using abbreviations supported by NOTE: You can also specify time values using abbreviations supported by
<<time-units,time units>> parsing. <<time-units,time units>> parsing.
===== Keys [[datehistogram-aggregation-keys]]
==== Keys
Internally, a date is represented as a 64 bit number representing a timestamp Internally, a date is represented as a 64 bit number representing a timestamp
in milliseconds-since-the-epoch (01/01/1970 midnight UTC). These timestamps are in milliseconds-since-the-epoch (01/01/1970 midnight UTC). These timestamps are
@ -353,7 +353,8 @@ Response:
-------------------------------------------------- --------------------------------------------------
// TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/] // TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
===== Time zone [[datehistogram-aggregation-time-zone]]
==== Time zone
{es} stores date-times in Coordinated Universal Time (UTC). By default, all bucketing and {es} stores date-times in Coordinated Universal Time (UTC). By default, all bucketing and
rounding is also done in UTC. Use the `time_zone` parameter to indicate rounding is also done in UTC. Use the `time_zone` parameter to indicate
@ -489,7 +490,7 @@ shorter intervals, like a `fixed_interval` of `12h`, where you'll have only a 11
bucket on the morning of 27 March when the DST shift happens. bucket on the morning of 27 March when the DST shift happens.
[[search-aggregations-bucket-datehistogram-offset]] [[search-aggregations-bucket-datehistogram-offset]]
===== Offset ==== Offset
// tag::offset-explanation[] // tag::offset-explanation[]
Use the `offset` parameter to change the start value of each bucket by the Use the `offset` parameter to change the start value of each bucket by the
@ -562,7 +563,8 @@ NOTE: The start `offset` of each bucket is calculated after `time_zone`
adjustments have been made. adjustments have been made.
// end::offset-note[] // end::offset-note[]
===== Keyed Response [[date-histogram-keyed-response]]
==== Keyed Response
Setting the `keyed` flag to `true` associates a unique string key with each Setting the `keyed` flag to `true` associates a unique string key with each
bucket and returns the ranges as a hash rather than an array: bucket and returns the ranges as a hash rather than an array:
@ -616,7 +618,8 @@ Response:
-------------------------------------------------- --------------------------------------------------
// TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/] // TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
===== Scripts [[date-histogram-scripts]]
==== Scripts
As with the normal <<search-aggregations-bucket-histogram-aggregation,histogram>>, As with the normal <<search-aggregations-bucket-histogram-aggregation,histogram>>,
both document-level scripts and both document-level scripts and
@ -632,6 +635,7 @@ For more information, see
<<search-aggregations-bucket-histogram-aggregation-extended-bounds,`Extended Bounds`>> and <<search-aggregations-bucket-histogram-aggregation-extended-bounds,`Extended Bounds`>> and
<<search-aggregations-bucket-histogram-aggregation-hard-bounds,`Hard Bounds`>>. <<search-aggregations-bucket-histogram-aggregation-hard-bounds,`Hard Bounds`>>.
[[date-histogram-missing-value]]
===== Missing value ===== Missing value
The `missing` parameter defines how to treat documents that are missing a value. The `missing` parameter defines how to treat documents that are missing a value.
@ -658,6 +662,7 @@ POST /sales/_search?size=0
<1> Documents without a value in the `publish_date` field will fall into the <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`. same bucket as documents that have the value `2000-01-01`.
[[date-histogram-order]]
===== Order ===== Order
By default the returned buckets are sorted by their `key` ascending, but you can By default the returned buckets are sorted by their `key` ascending, but you can
@ -665,13 +670,13 @@ control the order using
the `order` setting. This setting supports the same `order` functionality as the `order` setting. This setting supports the same `order` functionality as
<<search-aggregations-bucket-terms-aggregation-order,`Terms Aggregation`>>. <<search-aggregations-bucket-terms-aggregation-order,`Terms Aggregation`>>.
[[date-histogram-aggregate-scripts]]
===== Using a script to aggregate by day of the week ===== Using a script to aggregate by day of the week
When you need to aggregate the results by day of the week, use a script that When you need to aggregate the results by day of the week, use a script that
returns the day of the week: returns the day of the week:
[source,console,id=datehistogram-aggregation-script-example]
[source,console]
-------------------------------------------------- --------------------------------------------------
POST /sales/_search?size=0 POST /sales/_search?size=0
{ {

View File

@ -82,6 +82,7 @@ The response for the above aggregation:
[discrete] [discrete]
[role="xpack"] [role="xpack"]
[[geobounds-aggregation-geo-shape]]
==== Geo Bounds Aggregation on `geo_shape` fields ==== Geo Bounds Aggregation on `geo_shape` fields
The Geo Bounds Aggregation is also supported on `geo_shape` fields. The Geo Bounds Aggregation is also supported on `geo_shape` fields.

View File

@ -150,6 +150,7 @@ The response for the above aggregation:
[discrete] [discrete]
[role="xpack"] [role="xpack"]
[[geocentroid-aggregation-geo-shape]]
==== Geo Centroid Aggregation on `geo_shape` fields ==== Geo Centroid Aggregation on `geo_shape` fields
The centroid metric for geo-shapes is more nuanced than for points. The centroid of a specific aggregation bucket The centroid metric for geo-shapes is more nuanced than for points. The centroid of a specific aggregation bucket