{
	"script": {
		"lang": "mustache",
		"source": "\n\t\t {\n\t\t\t\"_source\": {\n\t\t\t\t\"includes\": [\n\t\t\t\t\t\"{{aggComponentName}}\",\n\t\t\t\t\t\"usage\"\n\t\t\t\t]\n\t\t\t},\n\t\t\t\"query\": {\n\t\t\t\t\"bool\": {\n\t\t\t\t\t\"must\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"range\": {\n\t\t\t\t\t\t\t\t\"timestamp\": {\n\t\t\t\t\t\t\t\t\t\"gte\": \"{{gte}}\",\n\t\t\t\t\t\t\t\t\t\"lte\": \"{{lte}}\",\n\t\t\t\t\t\t\t\t\t\"format\": \"epoch_millis\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"match_phrase\": {\n\t\t\t\t\t\t\t\t\"network_id.keyword\": {\n\t\t\t\t\t\t\t\t\t\"query\": \"{{networkId}}\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"match_phrase\": {\n\t\t\t\t\t\t\t\t\"network_group_id.keyword\": {\n\t\t\t\t\t\t\t\t\t\"query\": \"{{networkGroupId}}\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{{#componentName}},\n\t\t\t\t\t\t \n\t\t\t\t\t\t  {\n\t\t\t\t\t\t\t\"match_phrase\": {\n\t\t\t\t\t\t\t\t\"{{componentName}}\": {\n\t\t\t\t\t\t\t\t\t\"query\": \"{{componentValue}}\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t  \t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{{/componentName}}\n\t\t\t\t\t\t,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"bool\": {\n\t\t\t\t\t\t\t\t\"should\": [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"match_phrase\": {\n\t\t\t\t\t\t\t\t\t\t\t\"usage_type.keyword\": \"usage.ingress.tx\"\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\"match_phrase\": {\n\t\t\t\t\t\t\t\t\t\t\t\"usage_type.keyword\": \"usage.egress.tx\"\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\"minimum_should_match\": 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"size\": \"{{size}}\",\n\t\t\t\"aggs\": {\n\t\t\t\t\"unique_items\": {\n\t\t\t\t\t\"terms\": {\n\t\t\t\t\t\t\"field\": \"{{aggComponentName}}\",\n\t\t\t\t\t\t\"size\": \"{{aggTermSize}}\",\n\t\t\t\t\t\t\"order\": {\n\t\t\t\t\t\t\t\"item_sum\": \"desc\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"aggs\": {\n\t\t\t\t\t\t\"item_sum\": {\n\t\t\t\t\t\t\t\"sum\": {\n\t\t\t\t\t\t\t\t\"field\": \"usage\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t"
	}
}