- ElasticSearch:六、八、二十三**
我正在尝试返回当前具有指定小数点数目的聚合列的输出值,它返回具有13个小数点的输出。我已尝试在查询请求中设置格式,但它不起作用,使用的查询:
{
"size": 0,
"query": {
"bool": {
"adjust_pure_negative": true,
"must": [{
"range": {}
}
}, {
"terms": {}
}
]
}
},
"aggs": {
"composite_buckets": {
"composite": {
"sources": [{
"outputCol1": {
"terms": {
"missing_bucket": true,
"field": "col1",
"order": "asc"
}
}
}, {
"outputCol2": {
"terms": {
"missing_bucket": true,
"field": "col2",
"order": "asc"
}
}
}, {
"outputCol3": {
"terms": {
"value_type": "string",
"missing_bucket": true,
"script": {
"source": "1",
"lang": "painless"
},
"order": "asc"
}
}
}
]
},
"aggregations": {
"outputCol4": {
"format": "0.000"
"avg": {
"script": {
"source": "doc['col4'].value",
"lang": "painless"
}
}
}
}
}
}
}
我的问题:
1.当我们只查询某些字段时,是否可以更改小数点,因为输出也可以包含非十进制值,如Integer
和String
Elasticsearch
服务级别中是否有任何属性可以限制输出或存储字段中的小数点总数?
1条答案
按热度按时间new9mtju1#
我通过format属性格式化十进制输出(参见下面的示例)
}