ElasticSwift icon indicating copy to clipboard operation
ElasticSwift copied to clipboard

GetIndexResponse IndexSettings creationDate is returned as String (not Date)

Open lubbo opened this issue 5 years ago • 1 comments

The response of GetIndexRequest returns a wrong data type for Index settings field creation_date and the deserialization fails.

{ "settings": { "index": { "creation_date": "1563813426580", "number_of_shards": "1", "number_of_replicas": "1", "uuid": "N-yD3XmlQd28E9iR4iIliA", "version": { "created": "7000199" },

It's really weird but Elastic returns creation_date as String containing a date in epoch format (seconds from 1970).

lubbo avatar Jul 26 '19 16:07 lubbo

JsonDecoder needs date formatter in order to serialize string as date. A good default date formatter is required in order to achieve this. This also indicates scope of improvement in default serializer. Maybe these things need to be configurable in settings. If you can have a PR I can include this in alpha9.

FYI use master branch

prafsoni avatar Jul 26 '19 17:07 prafsoni