I have the following query which currently uses dynamic scripting. I have since found that my host doesn't support this, as it has wider reaching security implications. How would I rewrite this script so that it doesn't use dynamic script?
{
"size": 0,
"aggs": {
"filtered_cells": {
"filter": {
"geo_bounding_box": {
"loc": {
"top_left": "58.645976, -13.515625",
"bottom_right": "50.524473, 2.436523"
}
}
},
"aggs": {
"cells": {
"geohash_grid": {
"field": "loc",
"precision": 2
},
"aggs": {
"center_lat": {
"avg": {
"script": "doc['loc'].lat"
}
},
"center_lon": {
"avg": {
"script": "doc['loc'].lon"
}
}
}
}
}
}
},
"query": {
"match_all": {}
}
}