Aggregation Problem

Hi, I'm sending my order details to Kibana to be able to track all order details and items sold.

My items are in orderDetails.items but i can't seem to be able to aggregate by orderDetails.items.Quantity

dispatchedOn	Sep 2, 2020 @ 15:37:32.000
	id	5f4f914e721b456499e08922
orderDetails.items	
{
  "id": "5ec1thdyth9a851faba403d6837a41",
  "name": " Apfel-Zitrone-Ingwer, 0.75l ",
  "price": 1.79,
  "quantity": 2,
}

When i'm creating a table visual and use sum as aggregation for orderDetails.items.Quantity the visual bugs

Can anyone please tell me why and if it's related to the fact that orderDetails.items is not an indexed field since it contains a list

Thanks.

Yeah, if your field contains a list it won't be aggregatable in Kibana. You need to find a way to normalize your data without the list, at the same time keeping the relevancy for your use case.
The format that i'm thinking about is something like this:

{
order.id: "5f4f914e721b456499e08922",
item.id: "5ec1thdyth9a851faba403d6837a41".
name: "something",
price: 1.79,
quantity: 2,
dispatchedon: <insert date here>
}

I don't really know exactly how elasticsearch optimizes this, but I know it's smart and it won't increase the disk size as much as we'd think and this format makes all the data searchable and aggregatable. You can get pretty much anything from a format like that:

  • top orders by quantity of apple juice
  • when is apple juice ordered the most
    and so on.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.