1
我想根据按源分组的最大时间戳获取价格。Solr方面搜索 - 获取基于最大值和分组的价值
我现在拥有的Solr查询会为每个源拉取最大时间戳。我如何修改这个查询来拉取与最大时间戳相关的相应价格?
http://localhost:6500/solr/listings/select?q=desc_t:"Watch"&indent=on&rows=0&indent=true&wt=json&json.facet=
{
prices: {
type: terms,
field: source_s,
facet: {
max_ingestdate: "max(timestamp_dt)"
}
}
}
这个返回:
"facets":{
"count":141211,
"prices":{
"buckets":[{
"val":"a1",
"count":71466,
"max_ingestdate":1.505277283278E12},
{
"val":"a2",
"count":52415,
"max_ingestdate":1.501872553356E12},
{
"val":"a3",
"count":7866,
"max_ingestdate":1.504798294686E12},....
我也希望corressponding价格因此最终结果应该是:
"facets":{
"count":141211,
"prices":{
"buckets":[{
"val":"a1",
"count":71466,
"max_ingestdate":1.505277283278E12,
"price": 1334},
{
"val":"a2",
"count":52415,
"max_ingestdate":1.501872553356E12,
"price": 1234},
{
"val":"a3",
"count":7866,
"max_ingestdate":1.504798294686E12
"price": 1342},...
是。这里看起来像最佳的解决方案为止。 – Gayatri
我想知道是否有其他方法? – Gayatri