u/flobernd

LINQ to ES|QL is now available in the Elasticsearch .NET client
▲ 25 r/elasticsearch+1 crossposts

LINQ to ES|QL is now available in the Elasticsearch .NET client

Excited to share something Martijn Laarman and I have been working on: LINQ to ES|QL is now available in the Elasticsearch .NET client.

Starting with Elastic.Clients.Elasticsearch v9.3.4 and v8.19.18, you can write C# LINQ expressions that automatically translate into ES|QL queries at runtime. No more handcrafting query strings, just use the Where, Select, OrderBy, GroupBy, and other standard operators you already know (EntityFramework style).

Some highlights:

🔹 Automatic parameterization that prevents injection and enables query plan caching

🔹 Streaming materialization via IAsyncEnumerable<T> for constant memory usage

🔹 80+ ES|QL functions mapped to familiar C# methods

🔹 LOOKUP JOIN, aggregations, and server-side async queries all supported out of the box

🔹 Native AOT compatible

In the blog post, we dive deep into how it all works under the hood: the expression tree capture, the six-stage translation pipeline, the intermediate query model, and more.

If you're a .NET developer working with Elasticsearch, I'd love to hear what you think.

https://www.elastic.co/search-labs/blog/linq-esql-c-elasticsearch-net-client

u/flobernd — 9 days ago