Elasticsearch aggregations missing categories in Buckets

Asked

Viewed 36 times

2

I need to aggregate products by category

The "body" of the products is:

p1 = [ ... "categories": ["1","2","3","4"] ];
p2 = [ ... "categories": ["2","1","9","10"] ];
p3 = [ ... "categories": ["2","22","13","14"] ];
p4 = [ ... "categories": ["14","52","36","41"] ];

The aggregation query corresponds to:

{
            "aggregations": {
                "categories.raw": {
                    "terms": {
                        "field": "categories.raw"
                    }
                }
            }
            ,"from" : 0, "size" : 0
}

However, Buckets do not work with all product categories.

I need to count for all categories, for example:

categoria1 = 2
categoria2 = 3
...

Anyone can help?

  • I won’t refer your question to reopening yet because I could not understand what the doubt. I believe that the example (which unfortunately is still missing) gives a better idea

  • I can see that?

  • Yeah, I get it now

  • Can help?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.