0
votes

Is there a way in Azure Cognitive search to map output of skill to DateTimeOffset field? Getting an error:

Skill returns:

{ "values": [ { "recordId": "0", "data": { "date": "2020-09-25T04:00:00.0000000Z" }, "errors": null, "warnings": null } ] }

Indexer maps the skill output

"outputFieldMappings" : [ { "sourceFieldName": "/document/message_date", "targetFieldName": "message_date" } ]

where message_date defined as

{ "name": "message_date", "type": "Edm.DateTimeOffset", "sortable": true, "searchable": false, "filterable": true, "facetable": false },

Getting indexer error: The data field 'message_date' in the document with key 'NA_0138373324' has an invalid value of type 'Edm.String' (JSON String maps to Edm.String). The expected type was 'Edm.DateTimeOffset'

How to force indexer to convert it to date ? there is no mapping function like that

1

1 Answers

0
votes

Date and time values represented in the OData V4 format: yyyy-MM-ddTHH:mm:ss.fffZ or yyyy-MM-ddTHH:mm:ss.fff[+|-]HH:mm. Precision of DateTimeOffset fields is limited to milliseconds. If you upload DateTimeOffset values with sub-millisecond precision, the value returned will be rounded up to milliseconds (for example, 2015-04-15T10:30:09.7552052Z will be returned as 2015-04-15T10:30:09.7550000Z). When you upload DateTimeOffset values with time zone information to your index, Azure Cognitive Search normalizes these values to UTC. For example, 2017-01-13T14:03:00-08:00 will be stored as 2017-01-13T22:03:00Z. If you need to store time zone information, you will need to add an extra field to your index.

You can changed your datetime format to:

yyyy-MM-ddTHH:mm:ssZ

Example:"date": "2020-09-25T04:00:00Z"