0
0
Elasticsearchquery~10 mins

Date histogram in Elasticsearch - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a date histogram aggregation with a daily interval.

Elasticsearch
{
  "aggs": {
    "sales_over_time": {
      "date_histogram": {
        "field": "sale_date",
        "calendar_interval": "[1]"
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aday
Bhour
Cweek
Dmonth
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'interval' instead of 'calendar_interval'.
Choosing 'hour' when day grouping is needed.
2fill in blank
medium

Complete the code to set the time zone to 'UTC' in the date histogram aggregation.

Elasticsearch
{
  "aggs": {
    "sales_over_time": {
      "date_histogram": {
        "field": "sale_date",
        "calendar_interval": "day",
        "[1]": "UTC"
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Azone
Btimezone
Ctime_zone
DtimeZone
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'timezone' or 'timeZone' instead of 'time_zone'.
Omitting the time zone key entirely.
3fill in blank
hard

Fix the error in the date histogram aggregation by completing the missing key for minimum document count.

Elasticsearch
{
  "aggs": {
    "sales_over_time": {
      "date_histogram": {
        "field": "sale_date",
        "calendar_interval": "month",
        "[1]": 0
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Amin_document_count
Bmin_doc_count
Cmin_count
Dminimum_doc_count
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'min_document_count' which is invalid.
Using 'min_count' or 'minimum_doc_count' which do not exist.
4fill in blank
hard

Fill both blanks to create a date histogram aggregation with a weekly interval.

Elasticsearch
{
  "aggs": {
    "weekly_sales": {
      "date_histogram": {
        "field": "sale_date",
        "[1]": "[2]"
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Acalendar_interval
Btime_zone
Cweek
DAmerica/New_York
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing 'interval' with 'calendar_interval'.
Using 'weekly' instead of 'week'.
5fill in blank
hard

Fill all three blanks to create a date histogram aggregation with a monthly interval, time zone 'UTC', and minimum document count 0.

Elasticsearch
{
  "aggs": {
    "monthly_sales": {
      "date_histogram": {
        "[1]": "[2]",
        "[3]": "UTC",
        "min_doc_count": 0
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Acalendar_interval
Binterval
Cmonth
Dtime_zone
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'interval' instead of 'calendar_interval'.
Using 'timezone' instead of 'time_zone'.