elasticsearch elasticsearch groovy没有这样的属性:类的ctx
这是我第一次在elasticsearch中使用脚本,我遇到了以下问题:elasticsearch elasticsearch groovy没有这样的属性:类的ctx,elasticsearch,groovy,elasticsearch,Groovy,这是我第一次在elasticsearch中使用脚本,我遇到了以下问题: curl -XPOST 10.29.97.129:9200/.marvel-es-1-*/_search -d '{ "query": { "bool": { "filter": [ { "range": { "timestamp": {
curl -XPOST 10.29.97.129:9200/.marvel-es-1-*/_search -d '{
"query": {
"bool": {
"filter": [
{
"range": {
"timestamp": {
"gte": "now-2m",
"lte": "now"
}
}
},
{
"terms": {
"cluster_state.status": ["green", "yellow", "red"]
}
}
]
}
},
"_source": [
"cluster_state.status"
],
"sort": [
{
"timestamp": {
"order": "desc"
}
}
],
"size": 1,
"aggs": {
"minutes": {
"date_histogram": {
"field": "timestamp",
"interval": "5s"
},
"aggs": {
"status": {
"terms": {
"field": "cluster_state.status",
"size": 3
}
}
}
}
},
"script_fields" : {
"aggregationstest" : {
"script": "return ctx.payload"
}
}
}'
{“take”:5751,“timed_out”:false,“u shards”:{“total”:29,“successful”:12,“failed”:1,“failures”:[{“shard”:0,“index”:“.marvel-es-1-2016.07.04”,“node”:“ZjBZ7bt2QAmAvuDe-Uhf-A”,“reason”:{“type”:“script_exception”,“reason”:“failed”
使用lang运行内联脚本[返回ctx.payload]
[groovy],“由以下原因引起”:{“类型”:“缺少\u属性\u异常”,“原因”:“否”
此类属性:类的ctx:
390476cf551361b607cbac07bb49053c5bcd3e62“}}}}},点击:{“总计”:10,“最大分数”:null,“点击:[]}”,聚合:{“分钟”:{“桶”:[{“桶”:[{“键”为字符串:““2016-07-04T01:02:10.000Z”,“键”:14675941300000,“文档计数”:1,“状态”:{“文档计数错误上限”:0,“和其他文档计数”:0,“桶”:“{“键”为绿色”,“文档计数”:“2016-07-04T01:02:15.000Z”,“key”:1467594135000,“doc_count”:0,“status”:{“doc_count_error_上限”:0,“sum_other_doc_count”:0,“bucket”:[]},{“key_as string”:“2016-07-04T01:02:20.000Z”,“key”:14675944140000,“doc count”:1,“status”:{“doc count error_上限”:0,“sum_other_doc count count:0”,“sum”{“key_as string”:“bucket”:“key”{key”{2016-07-04T01:02:25.000Z,“键”:1467594145000,“文档计数”:0,“状态”:{“文档计数误差上界”:0,“和其他文档计数”:0,“桶”:[]},{“键作为字符串”:“2016-07-04T01:02:30.000Z”,“键”:146759415000,“文档计数”:1,“状态”:{“文档计数误差上界”:0,“和其他文档计数”:0,“和其他文档计数”:0,“键作为字符串”:“键”{2016-07-04T01:02:35.000Z,“键”:1467594155000,“文档计数”:0,“状态”:{“文档计数误差上界”:0,“和其他文档计数”:0,“桶”:[]},{“键作为字符串”:“2016-07-04T01:02:40.000Z”,“键”:14675941160000,“文档计数”:1,“状态”:{“文档计数误差上界”:0,“和其他文档计数”:0,“键作为字符串”:“{2016-07-04T01:02:45.000Z,“关键”:1467594165000,“doc_count”:0,“状态”:{“doc_count_error_upper_bound”:0,“sum_other_doc_count”:0,“Bucket”:[]},{“key_as_string”:“2016-07-04T01:02:50.000Z”,“key”:146759417170000,“doc_count”:1,“状态”:{“doc_count error upper_bound”0,“sum_other doc__count O”:“Bucket”:“{”0,“key_string”:2016-07-04T01:02:55.000Z,“键”:1467594175000,“文档计数”:0,“状态”:{“文档计数误差上界”:0,“和其他文档计数”:0,“桶”:[]},{“键作为字符串”:“2016-07-04T01:03:00.000Z”,“键”:1467594180000,“文档计数”:1,“状态”:{“文档计数误差上界”:0,“和其他文档计数”:0,“键作为字符串”:“{2016-07-04T01:03:05.000Z,“关键”:1467594185000,“doc_count”:0,“状态”:{“doc_count_error_upper_bound”:0,“sum_other_doc_count”:0,“Bucket”:{“key_as_string”:“2016-07-04T01:03:10.000Z”,“关键”:14675941190000,“doc_count”:1,“状态”:{“doc_count error upper_bound”0,“sum_other doc__count”0,“sum_count O”:“Bucket”{“key_string”:“key”{“绿色”doc}2016-07-04T01:03:15.000Z,“key”:1467594195000,“doc_count”:0,“status”:{“doc_count_error_上限”:0,“sum_other_doc_count”:0,“bucket”:[]},{“key_as string”:“2016-07-04T01:03:20.000Z”,“key”:14675942000,“doc count”:1,“status”:{“doc count count error_上限”:0,“sum_other_doc count”:0,“bucket”{“key”{“key”;“key”{“key”{2016-07-04T01:03:25.000Z,“键”:146759420000,“文档计数”:0,“状态”:{“文档计数误差上界”:0,“和其他文档计数”:0,“桶”:[]},{“键作为字符串”:“2016-07-04T01:03:30.000Z”,“键”:146759420000,“文档计数”:1,“状态”:{“文档计数误差上界”:0,“和其他文档计数”:0,“键作为字符串”:“{2016-07-04T01:03:35.000Z,“键”:1467594215000,“doc_count”:0,“状态”:{“doc_count_error_upper_bound”:0,“sum_other_doc_count”:0,“Bucket”:[]},{“key_as_string”:“2016-07-04T01:03:40.000Z”,“键”:14675942220000,“doc_count:0”,“状态”:{“doc_count error_upper_bound”0,“sum_other doc_count_count:0”,0,“sum_count as_string”:{0,“Bucket”{other other doc?0”,“Bucket”{as@O:“Bucket”{O.”“:146759425000,“doc_count”:0,“status”:{“doc_count_error_upper_bound”:0,“sum_other_doc_count”:0,“bucket”:{“key_as_string”:“2016-07-04T01:03:50.000Z”,“key”:146759423000,“doc_count”:0,“status”:{“doc_count or_error_uper_bound:0”,“sum_other_doc_count:0”,“bucket”:{,“bucket”:},{“key_as string”{“key"2016-07-0403;”“key”{“key"“key”;“key"0.0000; doc"count,“状态:{“doc_count_error_upper_bound”:0,“sum_other_doc_count”:0,“bucket”:{“key_as_string”:“2016-07-04T01:04:00.000Z”,“key”:146759424000,“doc count”:1,“状态:{“doc count error_upper_bound”:0,“sum_other_doc count:0”,“bucket”:{“key”:“key”:“green”,“doc count:1”}}}}
正如我所知,ctx
是groovy
defaultcontext
,任何人都可以给我一些提示