elasticlink brings type-safe, mapping-aware Elasticsearch queries to TypeScript
Elasticsearch's query DSL accepts malformed or mistyped queries without throwing errors, silently returning zero results and making bugs hard to catch. elasticlink is an open-source query builder that lets developers define an index mapping once in TypeScript, then enforces field-type rules and valid field names at compile time. Incorrect query types — such as using match() on a keyword field — and typos in field names are flagged as editor errors before code ever runs. The library is TypeScript-first but also supports plain JavaScript, and its .build() method outputs standard Elasticsearch DSL with no runtime overhead. The resulting query object plugs directly into the official @elastic/elasticsearch client, making elasticlink a compile-time-only dependency.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in