sudo-suhas / elastic-builder

A Node.js implementation of the elasticsearch Query DSL :construction_worker:
https://elastic-builder.js.org
MIT License
508 stars 75 forks source link

Make `Query` public to allow custom query extensions #184

Closed juntezhang closed 1 year ago

juntezhang commented 1 year ago

Export Query in index.js to allow extensions for special query types that may not be part of the official ES DSL.

We are using this query builder for OpenSearch, where a new plugin adds the neural query. I foresee that the type of queries used in OpenSearch and Elasticsearch will diverge in the future, so it would be nice that we can still use this module as a base to create queries for both.

There are also other query types used in ES in later versions, which are not commonly used, but can be useful to add yourself like the

By making the Query class public, it is easier to add extensions in TS.

Note that I have shared a workaround here to still allow extensions, but with this PR, we can skip that.

@sudo-suhas , can you please check this PR?

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 2.22.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: