How it's been for years
Model.aggregation(:gender, {terms: {field: :gender}, aggs: {position: {terms: {field: 'position.name'}}}})
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.
Model.aggregation :gender do
terms do
field :gender
aggregation :position do
terms field: 'position.name'
end
end
end
Validations could be smart, so things like terms would know that field is required.
terms(field: :gender)
or
terms do
field :gender
size 5
show_term_doc_count_error true
end
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
termswould know thatfieldis required.terms(field: :gender)or