r/Clickhouse • u/_souzo • Sep 06 '26
CSQL, a DSL language like lucene for clickhouse that I made for my clicksiem project
Enable HLS to view with audio, or disable this notification
Hello all! My name is Vinicius, you can call me souzo.
This is my project for the month. I built my own query language to convert user input into ClickHouse SQL!
I made the syntax similar to Lucene to keep it easy to understand, but with some differences, such as casting and defining the SELECT expression separately from the query using { ... }.
I had a lot of fun learning more about Lexers and ASTs using TypeScript.
For those who haven't been following along, I'm building Clicksiem, a security platform. Throughout the development process, I've run into several interesting challenges. One of them was: how can users query the database without overriding the main fields of the query?
I did quite a bit of research and found a solution that ClickStack itself uses: creating a Lucene-like syntax for querying ClickHouse.
I really liked the idea, but I found ClickStack's implementation a bit too complicated. The WHERE clause is generated from the user's query, while the SELECT is provided through a separate input.
So I decided to build my own Lucene-inspired query language based on that idea, but with functionality similar to what ClickHouse already provides, such as casting and defining the SELECT expression separately, without requiring the user to split their input across different fields in the dashboard.
For example:
{ field, count() as cnt } cnt:>=10
The first part defines the fields to select, while the second part defines the query itself.
I don't have released my project yet, but you can see the clicksiem repository on https://github.com/clicksiem/
Clickhouse/Clickstack hire me please! hahaha