Hi there
I need help to understand how to run post filter scripts to show only results with cardinality > 2.
{ "aggs" : { "products_items" : { "term": { "field": "product" } },
"aggs" : { "distinct_pricing" : { "cardinality" : { "field" : "price_types" } } },
"post_filter": {"script": {"script": "distinct_pricing[price_type].value > 2 "}}} } } }
Basically with we have products_items with many pricing types ;eg for VIP customers, VVIP customers & normal customers then we are interested to show only those items.
product_items price_type
001 VIP
001 VVIP
001 ORD
002 ORD
003 VIP
003 VVIP
004 VIP
005 ORD
005 VIP
Appreciate any help guidance.
Cheers