Note that there are some explanatory texts on larger screens.

plurals
  1. POelasticsearch group-by multiple fields
    primarykey
    data
    text
    <p>i am Looking for the best way to group data in elasticsearch. Elasticsearch doesnt support something like 'group by' in sql.</p> <p>Lets say i have 1k categories and millions of products. what do you think is the best way to render a complete category tree? of couse jou need some metadata (icon, link-target, seo-titles,...) and custom sorting for the categories. </p> <ol> <li><p>Using Aggregations: Example: <a href="https://found.no/play/gist/8124563" rel="noreferrer">https://found.no/play/gist/8124563</a> looks useable if you have to group by one field, and need some extra fields.</p></li> <li><p>Using multiple Fields in a Facet (wont work) Example: <a href="https://found.no/play/gist/1aa44e2114975384a7c2" rel="noreferrer">https://found.no/play/gist/1aa44e2114975384a7c2</a> Here we lose the relation between the different fields.</p></li> <li><p>Building funny Facets <a href="https://found.no/play/gist/8124810" rel="noreferrer">https://found.no/play/gist/8124810</a></p></li> </ol> <p>for example building a category tree using this 3 "solutions" sucks. Solution 1 may work (ES 1 isnt stable right now) Solution 2 doesnt work Solution 3 is pain, because it feels ugly, you need to prepare a lot of data and the facets blow up.</p> <p>May an alternative could be not to store any category data in ES, just the id <a href="https://found.no/play/gist/a53e46c91e2bf077f2e1" rel="noreferrer">https://found.no/play/gist/a53e46c91e2bf077f2e1</a></p> <p>than you could get the assocated category from another system, like redis, memcache or the database.</p> <p>this would end up in clean code, but the performance could become a problem. for example loading 1k Categories from memcache / Redis / a database could be slow. another problem is that syncing 2 databases is harder than syncing one.</p> <p>how do you deal with such problems?</p> <p>i am sorry for the links, but i cant post more than 2 ones in one article.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload