---
title: "Introducing Inverted Indices in ClickHouse"
description: "ClickHouse v23.1 adds experimental inverted indexes (contributed by IBM) as MergeTree secondary indexes for full-text term search."
url: "https://swe.quest/articles/introducing-inverted-indices-in-clickhouse-ecbc0f773fa09eed"
canonical: "https://clickhouse.com/blog/clickhouse-search-with-inverted-indices"
source: "ClickHouse"
published: "2023-02-02"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 11
tags: ["search","storage-engines","data-structures","analytics"]
---

# Introducing Inverted Indices in ClickHouse

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2023-02-02, 11 min read, Deep dive. Original: [https://clickhouse.com/blog/clickhouse-search-with-inverted-indices](https://clickhouse.com/blog/clickhouse-search-with-inverted-indices)

## Summary

ClickHouse v23.1 adds experimental inverted indexes (contributed by IBM) as MergeTree secondary indexes for full-text term search. Dictionaries are stored as minimized finite state transducers mapping terms to posting-list offsets, and posting lists are compressed with roaring bitmaps for fast unions and intersections. Indexes are built per part with single-pass in-memory inversion into segments stored across metadata, dictionary and posting-list files, so lookups never load the whole index. On 28.7M Hacker News comments, a hasToken query drops from 0.843s to 0.248s (about 3.4x), though part merges currently rebuild the index from scratch.

Written by swe.quest, not by the author.

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

## Topics

- [Search](https://swe.quest/tags/search.md) (Backend & APIs)
- [Storage engines](https://swe.quest/tags/storage-engines.md) (Data & databases)
- [Data structures](https://swe.quest/tags/data-structures.md) (Architecture & design)
- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)

## Prerequisites

- ClickHouse MergeTree tables ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))
- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- secondary/skip indexes

## Keywords

ClickHouse, inverted index, roaring bitmaps, finite state transducers, MergeTree, hasToken

## Related posts

- [Inside ClickHouse full-text search: fast, native, and columnar](https://swe.quest/articles/inside-clickhouse-full-text-search-fast-native-and-columnar-8035a7e0021a5f86.md): ClickHouse · 2025-08-18 · Medium · 19 min read · Search, Storage engines, Analytics & OLAP, Data structures
  ClickHouse rebuilt its full-text search around a native inverted "text" index that replaces the earlier Bloom-filter indexes (tokenbf\_v1, ngrambf\_v1), which were hard to tune, returned false positives and supported few predicates.
- [Announcing General Availability of ClickHouse Full-text Search](https://swe.quest/articles/announcing-general-availability-of-clickhouse-full-text-search-d53df0e10ad889b4.md): ClickHouse · 2026-03-10 · Medium · 13 min read · Search, Analytics & OLAP, Observability, Performance engineering
  ClickHouse Full-text Search is now generally available, implemented as a Lucene-style inverted index that maps tokens to row numbers using configurable tokenizers and preprocessors defined in SQL.
- [Building high-performance full-text search for object storage](https://swe.quest/articles/building-high-performance-full-text-search-for-object-storage-7061dd61b5d19a17.md): ClickHouse · 2026-03-24 · Hard · 33 min read · Search, Storage engines, Data structures, Analytics & OLAP, Performance engineering
  ClickHouse redesigned its full-text index for object storage, where per-request latency rather than bandwidth is the bottleneck.
- [What's new in ClickStack. January '26.](https://swe.quest/articles/what-s-new-in-clickstack-january-26-fe237899e085fba9.md): ClickHouse · 2026-02-11 · Medium · 13 min read · Observability, Analytics & OLAP, Search, Performance engineering
  ClickStack now supports ClickHouse's simpler bloom\_filter skip index with explicit tokens() tokenization for log body search, replacing hard-to-tune tokenbf\_v1 parameters with a single false-positive rate.
- [ClickHouse Release 23.1](https://swe.quest/articles/clickhouse-release-23-1-134a134aa389ba44.md): ClickHouse · 2023-01-30 · Medium · 8 min read · Analytics & OLAP, Search, Caching, SQL, Databases
  ClickHouse 23.1 adds experimental inverted full-text indices as a data-skipping index, parameterized views, and a TTL-based query results cache, alongside 17 features, 17 performance optimisations and 78 bug fixes.

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)
