我想对我的一个数组做一个统计方面的工作。我希望像如何在elasticsearch中获得数组的数量/大小
"script" : "doc['myField'].doubleValue
或
"script" : "doc['myField'].count
会工作。我还没有找到任何数组中的数组方法,我甚至不知道是否访问脚本中的数组字段实际上给了我数组。
我想对我的一个数组做一个统计方面的工作。我希望像如何在elasticsearch中获得数组的数量/大小
"script" : "doc['myField'].doubleValue
或
"script" : "doc['myField'].count
会工作。我还没有找到任何数组中的数组方法,我甚至不知道是否访问脚本中的数组字段实际上给了我数组。
我可能拥有它。看来我需要计算数组内的一个字段而不是数组本身。这可能只是因为我所有的都是对象数组。
"script" : "doc['arrayField.objectField'].values.length"
看看这里:http://stackoverflow.com/questions/12733351/how-do-i-sort-the-search-results-according-to-the-number-of-items-in -elasticsear/12734613#12734613 – javanna 2013-03-15 17:42:14