I have the following product order list and need to find out what products are ordered together:
[ { "order_id": 1, "products": ["Coke", "Fanta"], "created_on": "2016-12-26T03:41:46+00:00" }, { "order_id": 2, "products": ["Coke", "Pepsi", "Sprite"], "created_on": "2016-12-26T03:42:46+00:00" }, { "order_id": 3, "products": ["Coke", "Sprite"], "created_on": "2016-12-26T03:45:46+00:00" } ]
As per the above example, the correct aggregation output should be "Coke" and "Sprite" since they were ordered 3 times.
Expected output:
{ "products_duo_of_the_day": 1, "buckets": [ { "products": [ "Coke", "Sprite" ], "doc_count": 2 } ] }
Can someone please help me with building the Elastisearch query for getting this example output?