Date histogram
📖 Scenario: You work for a company that collects sales data with timestamps. You want to see how many sales happened each day.
🎯 Goal: Create an Elasticsearch query that groups sales by day using a date histogram aggregation.
📋 What You'll Learn
Create an Elasticsearch query with a date histogram aggregation named
sales_per_day.Use the field
sale_date for the date histogram.Set the interval to
day.Include a
match_all query to get all documents.💡 Why This Matters
🌍 Real World
Date histograms help businesses analyze trends over time, like daily sales or website visits.
💼 Career
Knowing how to write date histogram queries is useful for data analysts and backend developers working with time-series data in Elasticsearch.
Progress0 / 4 steps