Handle pre-epoch dates

Created on 18 December 2020, almost 4 years ago
Updated 15 August 2024, 3 months ago

Problem/Motivation

https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html

> Values for milliseconds-since-the-epoch and seconds-since-the-epoch must be non-negative. Use a formatted date to represent dates before 1970.

So the module fails to index any entities with a date field / timestamp before 1970.

Steps to reproduce

Create a date field on a content-type, add it to the index, create a new node with 1950.01.01. in the date field.

Proposed resolution

Use `formatted_date` instead of the epoch.

Data model changes

As I know, it won't change the data model, just how we store the date in ES, it's still a date for Elasticsearch.

🐛 Bug report
Status

Fixed

Version

7.0

Component

Code

Created by

🇭🇺Hungary aron novak Hungary, Budapest

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.

  • 🇬🇧United Kingdom Baysaa

    Does this affect 8.0.x?

    I'm getting

    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "full_date" plugin does not exist. Valid plugin IDs for Drupal\search_api\DataType\DataTypePluginManager are: elasticsearch_connector_date_range, elasticsearch_connector_rank_feature, object, elasticsearch_connector_search_as_you_type, decimal, date, string, text, integer, boolean in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

  • 🇫🇮Finland sokru

    The upgrade path didn't caught this, should create a new issue for providing the upgrade path.
    Using the "string" plugin provides following date

    1919-01-10T10:10:10
    

    Which I hope is sufficient.

Production build 0.71.5 2024