// This file is autogenerated, DO NOT EDIT
// aggregations/bucket/frequent-item-sets-aggregation.asciidoc:301

[source, python]
----
resp = client.search(
    index="kibana_sample_data_ecommerce",
    runtime_mappings={
        "price_range": {
            "type": "keyword",
            "script": {
                "source": "\n           def bucket_start = (long) Math.floor(doc['taxful_total_price'].value / 50) * 50;\n           def bucket_end = bucket_start + 50;\n           emit(bucket_start.toString() + \"-\" + bucket_end.toString());\n        "
            }
        }
    },
    size=0,
    aggs={
        "my_agg": {
            "frequent_item_sets": {
                "minimum_set_size": 4,
                "fields": [
                    {
                        "field": "category.keyword"
                    },
                    {
                        "field": "price_range"
                    },
                    {
                        "field": "geoip.city_name"
                    }
                ],
                "size": 3
            }
        }
    },
)
print(resp)
----
