Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-3488

Add support for nanosecond precision for temporal fields

    Details

      Description

      In HSEARCH-3047 Closed , 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.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                Yoann Rodière
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: