Aggregation in Elasticsearch : 3 Must-Know as Software Engineer.

Photo by Anna Nekrashevich from Pexels

Introduction

Aggregation: What are we talking about?

Let us seed our experiment index

  1. What’s the phone call that lasted the most?
  2. How many calls has every caller made so far?
  3. Who is the customer that called the most so far?
  4. How many minutes did John and Torsten spend on the phone?
  5. What is the average time of a call?

What is aggregation?

Metrics

Buckets

  • John: 6 calls
  • Torsten: 3 calls.
  • First of all, we create a bucket using the caller_name as key so that we have the calls group by caller.
  • Secondly, we apply inside of every bucket an aggregation which is a metric, to sum up, the duration fields.

Pipelines

Figure 1: Process of a pipeline aggregation
  • calls_per_caller_name is a normal aggregation to bucket and sum the durations per caller_name
  • duration_sum is our pipeline entry; the type of aggregation we are using here is avg_bucket (you can use sum_bucket and many others) to plot the average of calls_per_caller_name>duration per bucket.

Conclusion

  • Elasticsearch aggregation is mainly used for analytics.
  • There are basically three kinds of aggregation in Elasticsearch: metrics, buckets, and pipelines.
  • It’s possible to mix different kinds of aggregation to get statistics from an index.

--

--

--

Certified AWS Solution Architect, Fullstack Software Engineer & DevOps. I like Solving Challenging Software Engineering Problems & Building Amazing Solutions.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

3 Simple Steps To Technical Excellence As A Software Developer

Why I am Studying Software Engineering

Swit for iOS Version 1.72.9

The only good Python is Monty Python

Origin Wont Download On Mac

Why Software Engineers should remember Tacoma Bridge Collapse

6 Major Benefits Of The Logmate Digital Logbook

My Docker on macOS — Part #1 — Setup Ubuntu Virtual Machine (both Intel and Apple Silicon CPU…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Akintola L. F. ADJIBAO

Akintola L. F. ADJIBAO

Certified AWS Solution Architect, Fullstack Software Engineer & DevOps. I like Solving Challenging Software Engineering Problems & Building Amazing Solutions.

More from Medium

Full-stack application development with Inverno

Kibana: 5 Reasons Why You Should Start Using It Right Now.

My first look at gRPC

Implement Log Watcher (similar to tail -f command)