{
	"script": {
		"lang": "mustache",
		"source": {
			"_source": {
				"excludes": []
			},
			"query": {
				"bool": {
					"must": [
						{
							"match_phrase": {
								"eventtype": {
									"query": "Active"
								}
							}
						},
						{
							"bool": {
								"should": [
									{
										"match_phrase": {
											"resourcetype.keyword": "Service"
										}
									},
									{
										"match_phrase": {
											"resourcetype.keyword": "Endpoint"
										}
									},
									{
										"match_phrase": {
											"resourcetype.keyword": "Network"
										}
									},
									{
										"match_phrase": {
											"resourcetype.keyword": "AppWan"
										}
									},
									{
										"match_phrase": {
											"resourcetype.keyword": "Gateway"
										}
									}
								],
								"minimum_should_match": 1
							}
						}
					]
				}
			},
			"size": "{{size_query_param}}",
			"sort": [
				{
					"@timestamp": {
						"order": "desc",
						"unmapped_type": "boolean"
					}
				}
			],
			"aggs": {
				"2": {
					"terms": {
						"field": "name.keyword",
						"size": 5,
						"order": {
							"_count": "desc"
						}
					},
					"aggs": {
						"3": {
							"terms": {
								"field": "resourcetype.keyword",
								"size": 5,
								"order": {
									"_count": "desc"
								}
							}
						}
					}
				}
			},
			"docvalue_fields": [
				{
					"field": "@timestamp",
					"format": "date_time"
				}
			]
		}
	}
}