update this GET cyber\*/\_search
{
 "size": 0,
 "query": {
 "bool": {
 "must": [
 {
 "match": {
 "extended.network": "tor"
 }
 },
 {
 "match": {
 "is\_structured": "true"
 }
 },
 {
 "range": {
 "sys\_info.crawled": {
 "gte": "now-7d/d",
 "lt": "now/d"
 }
 }
 }
 ]
 }
 },
 "aggs": {
 "domains": {
 "terms": {
 "field": "site.domain",
 "size": 300
 },
 "aggs": {
 "instance\_id": {
 "terms": {
 "field": "sys\_info.instance\_id",
 "size": 300
 }
 },
 "c\_parser": {
 "terms": {
 "field": "sys\_info.content\_parser",
 "size": 300
 }
 },
 "current\_domains": {
 "terms": {
 "field": "site.current\_domain",
 "size": 300
 }
 }
 }
 }
 }
}

so i can replace this function

def get\_es\_query(network='tor', day\_range='7', size=400):
 """
 The function generates a query about the number of crawled documents for all domains according to the type of
 network and by the number of days
 :param network: type of network (openweb/tor)
 :param day\_range: number of days
 :param size: number of domains to return
 :return: query
 """
 q = (""" 
 {
 "size": 0,
 "query": {
 "bool": {
 "must": [
 {
 "match": {
 "extended.network": "%s"
 }
 },
 {
 "match": {
 "is\_structured": "true"
 }
 },
 {
 "range": {
 "sys\_info.crawled": {
 "gte": "now-%sd/d",
 "lt": "now/d"
 }
 }
 }
 ]
 }
 },
 "aggs": {
 "domains": {
 "terms": {
 "field": "site.domain",
 "size": %s
 },
 "aggs":{
 "current\_domains": {
 "terms": {
 "field": "site.current\_domain",
 "size": %s
 }
 }
 }
 }
 }
 }
 """ % (network, day\_range, size, size))
 return q

give me the finel function in code format
user