Open esmarkowski opened 3 months ago
Probably should just use this ... https://github.com/elastic/elasticsearch-dsl-ruby
I spent yesterday rewriting QueryMethods
and QueryBuilder
to use Elasticsearch::DSL
. I remember now why I didn't use it.
DSL
bool
and regexp
(and other similar functions) are mutually exclusive in DSL
and overwrite each other when calling .to_hash
The frustrating part is that it's full of promise and would simplify both QueryMethods
and QueryBuilder
considerably, with the added bonus of being able to provide the DSL as part of stretchy-model
. It also allows KeywordTransformer
to execute in QueryMethods
, so the values that get passed to DSL
don't need additional processing.
I'm going to fork Elasticsearch::DSL
and see if I can get to the bottom of it or create a fix. There's no mention of bool
and regexp
not being able to be defined together. Elasticsearch 8 puts the Regexp
inside the query
context, but the result is the same in DSL
, it just removes regexp
if there are any other clauses in bool
.
How it's been for years
How it could be
I'm not sure I even like this. However, it would be nice to be able to do some validations via this approach.
Validations could be smart, so things like
terms
would know thatfield
is required.terms(field: :gender)
or