【发布时间】:2014-05-22 15:23:56
【问题描述】:
我正在尝试使用我自己的参数从弹性搜索站点获取示例,但它不起作用。
查询:
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"range": {
"activity_date": {
"from": "2013-11-01",
"to": "2014-11-01"
}
}
}
}
},
"aggs": {
"net_ordered_units": {
"sum": {
"field": "net_ordered_units"
}
}
}
}
我得到的错误:
{
"error": "SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed; shardFailures {[YoGKlejVTC6jhg_OgPWXyTg][test][0]: SearchParseException[[test][0]: query[ConstantScore(cache(activity_date:[1383264000000 TO 1414886399999]))],from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\": {\"filtered\":{\"query\":{\"match_all\":{}},\"filter\":{\"range\":{\"activity_date\":{\"from\":\"2013-11-01\",\"to\":\"2014-11-01\"}}}}},\"aggs\":{\"net_ordered_units\":{\"sum\": {\"field\":\"net_ordered_units\"}}}}]]]; nested: SearchParseException[[test][0]: query[ConstantScore(cache(activity_date:[1383264000000 TO 1414886399999]))],from[-1],size[-1]: Parse Failure [No parser for element [aggs]]]; }]",
"status": 400
}
这里的分片故障是什么?它说没有 aggs 解析器,我应该在这里做什么? 基本上,我需要执行 sum 之类的操作,然后从中找出最大值。 我应该如何修改上面的代码来获得它?
【问题讨论】:
-
您是否使用任何插件来管理您的集群?
-
@eliasah 是的,内部包装插件。
-
您使用的是 Elasticsearch 1.0.0 还是更新版本?
-
@AlexBrasetvik ES 1.0.0,这有什么不同吗?
-
该搜索应该适用于 >= 1.0.0 的任何内容,并且会给出一个错误,就像您在旧版本中遇到的错误一样,因为 1.0.0 中引入了聚合。
标签: elasticsearch elasticsearch-aggregation