英文:
How to sort in Elasticserch by the arithmetic difference of two fields
问题
可以按照两个字段之间的算术差异对Elasticsearch数据进行排序吗?
数据如下所示:
{
"id": "123",
"price": 500.0,
"discount": 10.0
}
我需要按照 price - discount
的差异对数据进行排序。
总体上说,这种排序是可行的吗?
我还对通过Java API实现它感兴趣。
英文:
Is it possible to sort Elasticserch data by the arithmetic difference between the two fields?
The data are like this:
{
"id": "123",
"price": 500.0,
"discount": 10.0,
}
And I need to sort the data by the difference price - discount
.
Is it possible in general?
I am also interested in the implementation of it via Java API.
专注分享java语言的经验与见解,让所有开发者获益!
评论