我有以下当前使用动态脚本的查询。从那以后,我发现我的主机不支持这一点,因为它具有更广泛的安全影响。我将如何重写此脚本以使其不使用动态脚本?
{
"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": {}
}
}