1
我尝试评估我的masterthesis网络应用程序。为此,我想进行一项用户研究,在那里准备elasitc中的数据,并将我的Web应用程序发送给测试人员。据我所知,弹性发现不允许动态脚本出于安全原因。我尝试refomulate以下动态脚本查询:没有动态脚本的术语频率汇总脚本
GET my_index/document/_search
{
"query": {
"match_all":{}
},
"aggs": {
"stadt": {
"sum": {
"script": "_index['textBody']['frankfurt'].tf()"
}
}
}
}
该查询总结了在文档领域textBody
所有词频,任期frankfurt
。
为了在不使用动态脚本的情况下重新构造查询,我在groovy scripts without dynamic scripting上看了一下,但仍然收到了解析错误。
我的这种方法是:
GET my_index/document/_search
{
"query": {
"match_all":{}
},
"aggs": {
"stadt": {
"sum": {
"script": {
"script_id": "termFrequency",
"lang" : "groovy",
"params": {
"term" : "frankfurt"
}
}
}
}
}
}
,并在scripts
目录中的文件termFrequency.groovy
:
_index['textBody'][term].tf()
我得到以下分析错误:
Parse Failure [Unexpected token START_OBJECT in [stadt].]
你正在使用什么版本的ES? – ChintanShah25
我正在使用ES 1.7.3 – boraas