我有以下查詢當前使用動態腳本。之後我發現我的主機不支持這個,因爲它具有更廣泛的安全影響。我將如何重寫這個腳本,以便它不使用動態腳本?不使用動態腳本查詢
{
"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": {}
}
}
你可以[將腳本移動到文件](https: //www.elastic.co/blog/running-groovy-scripts-without-dynamic-scripting)?或者,更好地說,您的主機是否允許您在ES安裝目錄中放置.groovy文件? –