Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulating field collapsing/grouping by field in Elastic Search

Elastic Search does not currently (as of 0.18.4) support field collapsing. Is there a good way to simulate this, as to avoid N search queries?

like image 295
Carson Avatar asked Oct 20 '25 16:10

Carson


2 Answers

Probably not the answer you're looking for but: As far as I know, and according to this ticket, the only real workaround is to select a larger result set and group on the client side.

like image 156
Joel Abrahamsson Avatar answered Oct 23 '25 06:10

Joel Abrahamsson


Depending on what your use case is you might find parent/child support or nested types useful instead.

You can find more about parent/child support here: https://github.com/elasticsearch/elasticsearch/issues/553 (and then in corresponding query/filter doc pages)

As for nested types, check here: http://www.elasticsearch.org/guide/reference/mapping/nested-type.html

like image 21
Lukas Vlcek Avatar answered Oct 23 '25 06:10

Lukas Vlcek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!