Java 处理「;JSON不允许使用非有限数字“;弹性搜索
嗨,我正在尝试在索引中使用MAX函数对字段进行聚合,问题是当我在时间范围内没有该值时,使用group by进行聚合失败Java 处理「;JSON不允许使用非有限数字“;弹性搜索,java,elasticsearch,Java,elasticsearch,嗨,我正在尝试在索引中使用MAX函数对字段进行聚合,问题是当我在时间范围内没有该值时,使用group by进行聚合失败 POST /_opendistro/_sql { "query": "SELECT date(timeStamp) time_unit, MAX(testField) test_field_alias FROM my_index where orgId = 'xyz' and timeStamp <= '2020-07-04T23:
POST /_opendistro/_sql
{
"query": "SELECT date(timeStamp) time_unit, MAX(testField) test_field_alias FROM my_index where orgId = 'xyz' and timeStamp <= '2020-07-04T23:59:59' and timeStamp >= '2020-07-01T00:00' group by date(timeStamp) order by time_unit desc"
}
当我尝试上面的查询时,我得到
{
"error": {
"root_cause": [
{
"type": "j_s_o_n_exception",
"reason": "JSON does not allow non-finite numbers."
}
],
"type": "j_s_o_n_exception",
"reason": "JSON does not allow non-finite numbers."
},
"status": 500
}
我知道在索引中的文档中没有上述字段的时间段会发生这种情况,因此我在映射中添加了“null\u value”:0
,但仍然没有任何用处
问题是我想使用
MAX
函数按时间尺度分组进行聚合,如果有另一种方法可行,这对我来说已经足够了,它不必只有SQL格式。您能分享您面临此问题的Elasticsearch版本吗?它的elastic 7.4 OpenDistrict版本您能分享您面临此问题的Elasticsearch版本吗?它的elastic 7.4 OpenDistrict版本吗
{
"error": {
"root_cause": [
{
"type": "j_s_o_n_exception",
"reason": "JSON does not allow non-finite numbers."
}
],
"type": "j_s_o_n_exception",
"reason": "JSON does not allow non-finite numbers."
},
"status": 500
}