We're updating the issue view to help you get more done. 

Add support for nanosecond precision for temporal fields

Description

In HSEARCH-3047, we added support for many temporal types, but we opted to stick to millisecond resolution for index and doc values, to match what Elasticearch 6 can offer. Nanosecond precision is only supported for projections.

We should allow users to switch to nanoseconds precision on an opt-in basis.

One way to do that would be to offer an `@TemporalField` annotation in the mapping, so that users can simply write @TemporalField(resolution = Resolution.NANOSECOND.

We would have to add support for that resolution in the backends.

In Elasticsearch, we cannot do that before ES7, which introduces the date_nanos datatype: https://www.elastic.co/guide/en/elasticsearch/reference/master/date_nanos.html . Let's just throw exceptions for older versions of ES.

In Lucene, that would probably mean storing the data as a string, like we used to do in Search 5. But maybe ES7 has a better solution, so let's have a look.

Important: be sure to use Resolution.DEFAULT as the default, not Resolution.MILLISECOND, so that we can one day provide an option to set the default resolution in the backend options.

Environment

None

Status

Assignee

Unassigned

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Fix versions

Priority

Major