-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[IllegalStateException] last() should not be called in this context #32848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Pinging @elastic/es-search-aggs |
@jinhucheung I am not able to reproduce, can you add the analyzer definitions for |
@jimczi thanks, I highlighted the code_pieces fields cause this error. code_pieces is array type, the following is an simple response of a query without highlight code_pieces {
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 46,
"max_score" : 921.8962,
"hits" : [
{
"_index" : "code_index_production",
"_type" : "code",
"_id" : "45899",
"_score" : 921.8962,
"_source" : {
"id" : 1,
"public" : 1,
"user_id" : 1,
"lang_id" : 2,
"root_id" : 0,
"category_id" : 3,
"enterprise_id" : 0,
"stars_count" : 0,
"forks_count" : 0,
"notes_count" : 0,
"pieces_count" : 1,
"in_square" : true,
"lang_name" : "PHP",
"summary" : "layui分页",
"name_with_summary" : "jimcheung / layui分页",
"created_at" : "2017-11-25T13:53:45+08:00",
"updated_at" : "2017-11-25T13:53:45+08:00",
"code_pieces" : [
{
"id" : 59766,
"content_type" : 0,
"content" : "var title = $(\"input[name='title']\").val();\r\n\tvar begin_time =$(\"input[name='begin_time']\").val();\r\n\tvar end_time=$(\"input[name='end_time']\").val();\r\n layui.use(['laypage', 'layer'], function(){\r\n var laypage = layui.laypage\r\n ,layer = layui.layer;\r\n layui.use(['laypage', 'layer'], function() {\r\n var laypage = layui.laypage\r\n ,layer = layui.layer;\r\n laypage.render({\r\n elem: 'demo1',\r\n count: {$count},\r\n limit:15,\r\n curr:{$curr},\r\n jump: function(e, first){ //触发分页后的回调\r\n if(!first){ //一定要加此判断,否则初始时会无限刷新\r\n location.href = '?page='+e.curr+\"&title=\"+title+\"&begin_time=\"+begin_time+\"&end_time=\"+end_time;\r\n }\r\n }\r\n });\r\n });\r\n\r\n });",
"title" : "分页"
}
]
},
"highlight" : {
"name_with_summary" : [
"jimcheung / <em>layui</em>分页"
]
}
}
]
}
} here is the jcseg analyzer and its elasticsearch plugin |
@jinhucheung I am not able to reproduce with the example document. Could you please provide the document that is causing the exception ? |
@jimczi I am sorry for the late response The following is a document that is causing this exception "_source" : {
"id" : 46867,
"public" : 1,
"user_id" : 1619994,
"lang_id" : 3,
"root_id" : 0,
"category_id" : 89,
"enterprise_id" : 0,
"stars_count" : 0,
"forks_count" : 0,
"notes_count" : 0,
"pieces_count" : 3,
"in_square" : true,
"lang_name" : "JavaScript",
"summary" : "Layui上传多附件材料代码",
"name_with_summary" : "LKBBD / Layui上传多附件材料代码",
"created_at" : "2017-12-03T13:56:06+08:00",
"updated_at" : "2017-12-03T13:59:33+08:00",
"code_pieces" : [
{
"id" : 62466,
"content_type" : 0,
"content" : "基于layui,引入layui.css,layui.js及jquery.js等\r\n<link rel=\"stylesheet\" href=\"/style/layui/css/layui.css\" type=\"text/css\" media=\"all\"></link>\r\n<script type=\"text/javascript\" src=\"/style/layui/layui.js\"></script>",
"title" : "js静态资源部分(主要)"
},
{
"id" : 62467,
"content_type" : 0,
"content" : "<div class=\"layui-upload\">\r\n <button type=\"button\" class=\"layui-btn layui-btn-normal\" id=\"testList\">选择多文件</button> \r\n <div class=\"layui-upload-list\">\r\n <table class=\"layui-table\">\r\n <thead>\r\n <tr>\r\n <th style=\"width:40%;text-align:left;padding:10px 20px;\">文件名</th>\r\n <th style=\"width:20%;text-align:left;padding:10px 20px;\">大小</th>\r\n <th style=\"width:20%;text-align:left;padding:10px 20px;\">状态</th>\r\n <th style=\"width:20%;text-align:left;padding:10px 20px;\">操作</th>\r\n </tr>\r\n </thead>\r\n <tbody id=\"demoList\"></tbody>\r\n </table>\r\n </div>\r\n <button type=\"button\" class=\"layui-btn\" id=\"testListAction\">开始上传</button>\r\n</div> ",
"title" : "html部分"
},
{
"id" : 62468,
"content_type" : 0,
"content" : "layui.use('upload', function(){\r\n var $ = layui.jquery,\r\n upload = layui.upload;\r\n var files = [];\r\n var demoListView = $('#demoList'),\r\n uploadListIns = upload.render({\r\n elem: '#testList',\r\n url: '/file/ftp/upload/',//FTP上传 \r\n accept: 'file',\r\n multiple: true,\r\n auto: false,\r\n size: 6000, //限制文件大小,单位 KB\r\n exts: 'jpg|png|xlsx|docx|pdf',//只允许上传文件类型\r\n bindAction: '#testListAction',\r\n choose: function(obj){ \r\n files = obj.pushFile(); //将每次选择的文件追加到文件队列\r\n //读取本地文件\r\n obj.preview(function(index, file, result){\r\n var tr = $(['<tr id=\"upload-'+ index +'\">',\r\n '<td style=\\\"width:40%;padding:10px;text-align:left;font-size:14px;\\\">'+ file.name +'</td>',\r\n '<td style=\\\"width:20%;padding:10px;text-align:left;font-size:14px;\\\">'+ (file.size/1014).toFixed(1) +'kb</td>',\r\n '<td style=\\\"width:20%;padding:10px;text-align:left;font-size:14px;\\\">等待上传</td>',\r\n '<td style=\\\"width:20%;padding:10px;text-align:left;font-size:14px;\\\">',\r\n '<button class=\"layui-btn layui-btn-mini demo-reload layui-hide\">重传</button>',\r\n '<button class=\"layui-btn layui-btn-mini layui-btn-danger demo-delete\">删除</button>',\r\n '</td>',\r\n '</tr>'].join(''));\r\n //单个重传\r\n tr.find('.demo-reload').on('click', function(){\r\n obj.upload(index, file);\r\n });\r\n //删除\r\n tr.find('.demo-delete').on('click', function(){\r\n delete files[index]; //删除对应的文件\r\n tr.remove();\r\n });\r\n demoListView.append(tr);\r\n });\r\n },\r\n done: function(res, index, upload){\r\n if(res.code == 0){ //上传成功\r\n var tr = demoListView.find('tr#upload-'+ index),\r\n tds = tr.children();\r\n tds.eq(2).html('<span style=\"color: #5FB878;\">上传成功</span>');\r\n tds.eq(3).html(''); //清空操作\r\n var file_ids = $(\"input[name='dwyyzzsmj']\").val();\r\n file_ids = file_ids + \"//\" + res.fileid;\r\n $(\"input[name='dwyyzzsmj']\").val(\"\");\r\n $(\"input[name='dwyyzzsmj']\").val(file_ids);\r\n delete files[index]; //删除文件队列已经上传成功的文件\r\n return;\r\n }\r\n this.error(index, upload);\r\n },\r\n error: function(index, upload){\r\n var tr = demoListView.find('tr#upload-'+ index),\r\n tds = tr.children();\r\n tds.eq(2).html('<span style=\"color: #FF5722;\">上传失败</span>');\r\n tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传\r\n }\r\n });\r\n});",
"title" : "js实现部分"
}
]
} here is a raw_code_pieces.zip I highlight the code_pieces content cause the exception. When I changed I think that the exception is caused by thanks |
@jimczi thanks, I close this issue |
Elasticsearch version (
bin/elasticsearch --version
): 6.3.1Plugins installed: [jcseg]
JVM version (
java -version
): 1.8.0_172OS version (
uname -a
if on a Unix-like system): 4.4.0-127-generic #153-Ubuntudao
Description of the problem including expected versus actual behavior:
An error
last() should not be called in this context
occurred when get the total number of hitsSteps to reproduce:
I search keyword 'layui' via elasticsearch-rails, then get an error when getting the total count of hits
ruby code
query options:
index settings:
Provide logs (if relevant):
thanks a lot for elasticsearch
Jim Cheung
The text was updated successfully, but these errors were encountered: