-
Book Overview & Buying
-
Table Of Contents
ElasticSearch Cookbook - Second Edition
By :
The previous recipe works mainly on numeric fields; ElasticSearch provides a custom date histogram aggregation to operate on date/date-time values. This aggregation is required because date values need more customization to solve problems such as time zone conversion and special time intervals.
You need a working ElasticSearch cluster and an index populated with the script (chapter_06/executing_date_histogram_aggregations.sh) available at https://github.com/aparo/elasticsearch-cookbook-second-edition.
We need two different date/time aggregations that are:
An annual aggregation
A quarter aggregation, but with time zone +1:00
To execute date histogram aggregations, we will perform the steps given as follows:
The query will be as follows:
curl -XGET 'http://127.0.0.1:9200/test-index/test-type/_search? pretty=true' -d '
{
"query": {
"match_all": {}
},
"aggs": {
"date_year": {
"date_histogram": {
"field...
Change the font size
Change margin width
Change background colour