Facets for created > granularity: year give results in the year 50,000 AD

Created on 14 March 2021, over 3 years ago
Updated 3 September 2024, 3 months ago

Using Elastic Search connector & Search API
I've indexed the node.created field
I've set up a facet for "Filter by Year" and set the date granularity to: Year

Expected results:
- 2021 (22)
- 2020 (12)
- 1999 (38)

Actual results
- 53232 (1)
- 53453 (2)
- 58753 (1)
- 52772 (1)
- 52323 (1)
- etc.

(the numbers are *not* node ids, my node ids don't go over 2000)
I have no idea where this numbers like 53212 are coming from. The node created dates are normal dates in 2021 and 2020 etc.

If I do the same for Month and Day, it does work! It just doesn't work for year.
Is this a facet API problem?

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand janpongos

    I got the same issue as well. I wonder what causes the timestamp to use a milliseconds value instead of seconds.

    I think if all timestamp are in seconds, the issue will be resolve. So for now I use this patch to force convert the value into seconds if it found any milliseconds.

    It will really be good if anyone can point out why timestamps got into milliseconds in the first place, then this should not be an issue.

    Patch is for version 3.0.0-beta1.

  • 🇬🇧United Kingdom gsquirrel London

    Not sure if this helps to debug this but I only had this issue after switching from database backend to elastic search - are any others with the issue also using elastic search?

    In the end I found a workaround using a custom field added to the index that stored year only via a token - then used that as facet source instead.

Production build 0.71.5 2024