---
title: "ClickHouse vs. Elasticsearch: The Billion-Row Matchup"
description: "On a single 32-core c6a.8xlarge node loaded with 1, 10 and 100 billion PyPI download rows, ClickHouse beats Elasticsearch on count(*) GROUP BY aggregations (Elasticsearch terms aggregations)."
url: "https://swe.quest/articles/clickhouse-vs-elasticsearch-the-billion-row-matchup-227267b2f21c24e1"
canonical: "https://clickhouse.com/blog/clickhouse_vs_elasticsearch_the_billion_row_matchup"
source: "ClickHouse"
published: "2024-05-07"
difficulty: "medium"
kind: "Research"
reading_minutes: 28
tags: ["analytics","performance","search","databases","observability"]
---

# ClickHouse vs. Elasticsearch: The Billion-Row Matchup

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2024-05-07, 28 min read, Research. Original: [https://clickhouse.com/blog/clickhouse\_vs\_elasticsearch\_the\_billion\_row\_matchup](https://clickhouse.com/blog/clickhouse_vs_elasticsearch_the_billion_row_matchup)

## Summary

On a single 32-core c6a.8xlarge node loaded with 1, 10 and 100 billion PyPI download rows, ClickHouse beats Elasticsearch on count(\*) GROUP BY aggregations (Elasticsearch terms aggregations). ClickHouse needs 12–19x less storage and delivers at least 5x lower query latency, so roughly 4x cheaper hardware matches Elasticsearch's latency. Its materialized views are also cheaper in storage and compute than Elasticsearch transforms for continuous summarization. The setup details cover ILM rollover, index sorting by cardinality, LZ4 vs DEFLATE/ZSTD codecs, \_source tradeoffs and shard parallelism, and note that Elasticsearch could not ingest the 100B-row dataset.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Search](https://swe.quest/tags/search.md) (Backend & APIs)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)

## Prerequisites

- SQL GROUP BY aggregations ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- columnar storage basics
- Elasticsearch indices and shards ([easy posts on Search](https://swe.quest/tags/search.md?difficulty=easy))

## Keywords

ClickHouse, Elasticsearch, PyPI, Logstash, materialized views, doc\_values, Parquet, ClickHouse Cloud

## Related posts

- [ClickHouse vs. Elasticsearch: The Mechanics of Count Aggregations](https://swe.quest/articles/clickhouse-vs-elasticsearch-the-mechanics-of-count-aggregations-fa943a94e2c565e4.md): ClickHouse · 2024-05-07 · Medium · 15 min read · Query engines, Analytics & OLAP, Search, Performance engineering
  ClickHouse runs count(\*) GROUP BY aggregations in parallel at three levels: SIMD within column values, multiple cores over arbitrary data ranges, and multiple nodes over shards.
- [Do you still need Elasticsearch for log analytics? ClickHouse says no.](https://swe.quest/articles/do-you-still-need-elasticsearch-for-log-analytics-clickhouse-says-no-7011cded5588b0ad.md): ClickHouse · 2026-04-23 · Medium · 22 min read · Search, Analytics & OLAP, Observability, Performance engineering, Storage engines
  ClickHouse's redesigned inverted-index full-text search feeds matches directly into its vectorized analytical engine, and on a reproducible OpenTelemetry log benchmark at 1B, 10B and 50B rows it ran a nine-query search-plus-aggregation suite 2-6x faster than Elasticsearch, with a much smaller storage footprint.
- [How Rokt Achieved Real-time Reporting with ClickHouse](https://swe.quest/articles/how-rokt-achieved-real-time-reporting-with-clickhouse-89f752e157ebd50c.md): ClickHouse · 2022-12-06 · Easy · 4 min read · Analytics & OLAP, Databases, Cost optimization, E-commerce
  Rokt replaced an Elasticsearch-backed reporting layer with ClickHouse.
- [Contentsquare Migration from Elasticsearch to ClickHouse](https://swe.quest/articles/contentsquare-migration-from-elasticsearch-to-clickhouse-052c118198db3e2f.md): ClickHouse · 2022-10-11 · Medium · 6 min read · Analytics & OLAP, Refactoring & migrations, Distributed databases, Performance engineering, Cost optimization
  Contentsquare replaced 14 Elasticsearch clusters with ClickHouse over a phased migration.
- [Didi Migrates from Elasticsearch to ClickHouse for a new Generation Log Storage System](https://swe.quest/articles/didi-migrates-from-elasticsearch-to-clickhouse-for-a-new-generation-log-storage-50fcb56512cab39a.md): ClickHouse · 2024-04-19 · Medium · 11 min read · Analytics & OLAP, Observability, Storage engines, Scaling, Cost optimization
  Didi replaced Elasticsearch with ClickHouse for petabyte-per-day log and trace storage, cutting machine cost by 30% and speeding up queries about 4x on a 400+ node single-replica deployment peaking at 40 GB/s writes and ~200 QPS.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
