要不要也来分享分享一下啊

ES SQL orderby groupby后的count做排序会报错

Elasticsearch | 作者 zz_zxb | 发布于2020年05月06日 | 阅读数:4561

ES版本:6.6.1运行SQL:
POST _xpack/sql?format=txt
{
  "query":"select opIp,count(1) ipcount from systemlog   group by opIp order by ipcount"
}
 
报错信息:
{
  "error": {
    "root_cause": [
      {
        "type": "verification_exception",
        "reason": "Found 1 problem(s)\nline 1:70: Cannot order by non-grouped column [ipcount], expected [opIp]"
      }
    ],
    "type": "verification_exception",
    "reason": "Found 1 problem(s)\nline 1:70: Cannot order by non-grouped column [ipcount], expected [opIp]"
  },
  "status": 400
}
已邀请:

byx313 - BLOG:https://www.jianshu.com/u/43fd06f9589c

赞同来自:

select opIp,count(1) as ipcount from systemlog   group by opIp order by ipcount
这样试试?
 

要回复问题请先登录注册