| There is a solution, I think: use a custom field bridge implementing MetadataProvidingFieldBridge, set the type of your field to FieldType.DATE, and convert your integer to a string before putting it in the document. Without this, there is no way Hibernate Search could guess that your field is actually a date. Now, this is pretty limited for now, as your Elasticsearch property will have to be mapped to exactly this format: "strict_date_optional_time|epoch_millis". It is the default format in Elasticsearch, and it is the format we use for java.util.Date. We will add a way to customize the expected format in the future, but this will have to wait Search 6.0 for multiple reasons. One of those reasons is that field bridges currently mix two concepts: converting entity data to index data (which is independent of whether you use embedded Lucene or Elasticsearch) and encoding index data in a given format (which is totally dependent on whether you use embedded Lucene or Elasticsearch). We will separate the two concepts in Search 6.0, so that this kind of use case will be easier to support. |