Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
This bug is quite difficult to explain it, so I will first show it with an example and then explain it.
I have a core splitted into three shards, let's call them 'sellers_2014', 'sellers_2015', 'sellers_2016'.
The schema has the following fields:
seller_name, string
seller_measure, double
seller_date, date
With the following data.
'sellers_2014'
Tyrion, 1, 2014-01-01T00:00:00Z
Jon, 50, 2014-01-01T00:00:00Z
PoorNed, 4, 2014-01-01T00:00:00Z
'sellers_2015'
Tyrion, 100, 2015-01-01T00:00:00Z
Jon, 50, 2015-01-01T00:00:00Z
PoorNed, 4, 2015-01-01T00:00:00Z
'sellers_2016'
Tyrion, 1, 2015-01-01T00:00:00Z
Jon, 50, 2015-01-01T00:00:00Z
PoorNed, 4, 2015-01-01T00:00:00Z
{ top_sellers: { type: terms, field: seller_name, limit: 2, offset: 0, sort: "seller_measure desc", facet: { seller_measure: "sum(seller_measure)", seller_dates: { type: range, field: seller_date, start: "2014-01-01T00:00:00Z", end: "2016-12-31T00:00:00Z", gap: "+1YEARS", facet: { seller_measure: "sum(seller_measure)" } } } } }
So... With the request I want to know the top 2 sellers across the three shards and for each seller, their seller_measure for each year.
The response I'm getting is:
"val": "Jon", "count": 3, "seller_measure": 150, "seller_dates": { "buckets": [ { "val": "2014-01-01T00:00:00Z", "count": 1, "seller_measure": 50 }, { "val": "2015-01-01T00:00:00Z", "count": 1, "seller_measure": 50 }, { "val": "2016-01-01T00:00:00Z", "count": 1, "seller_measure": 50 } ] }, "val": "Tyrion", "count": 3, "seller_measure": 102, "seller_dates": { "buckets": [ { "val": "2015-01-01T00:00:00Z", "count": 1, "seller_measure": 100 } ] }
which is incorrect, because the two buckets of 2014 and 2016 in Tyrion are missing.