Allow 'long', 'int' and 'string' entity fields to map on 'date' Elasticsearch field

Description

Elasticsearch accepts multiple types of input type when indexing a field with type 'date':

  • string containing a formatted date

  • long representing milliseconds since epoch

  • int representing seconds since epoch

From what I can see currently, if the corresponding entity field is not of type Date but 'long' instead, ElasticSearch schema validation will fail with the following error:

Invalid value for attribute 'type'. Expected 'LONG', actual is 'DATE'

I suggest the type validation be more permissive in case of 'date' fields. Unless, of course, I am missing another solution to this problem.

Environment

Hibernate ORM 5.1.3.Final
Hibernate Search 5.6.1.Final
Elasticsearch 2.3.2
Java EE 7
DB engine: Aurora 5.6.10a

Status

Assignee

Unassigned

Reporter

Ivan Krumov

Labels

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Affects versions

Priority

Major
Configure