Elasticsearch doesn't sort by date

For some strange reason, my elastic search sorting doesn’t work really… it’s just ignored. maybe you some of you can point me to a problem here?

I am getting the items by the following:

posts =
  .exactMatch('tags', node).sortDesc('publishedAt').execute()}

according to the elastic search docs, I have this field:

   type: DateTime
   defaultValue: ''
     label: 'Publishing Date'
     reloadIfChanged: TRUE
       group: 'general'
     type: 'date'
     format: 'date_time_no_millis'
   indexing: '${(value ? Date.format(value, "Y-m-d\TH:i:sP") : null)}'

The listing doesn’t change at all if I use sortAsc or sortDesc. Also the result is not sorted at all.

Mayone someone has suggestions on how to proceed…

If that is your NodeTypes configuration you are missing the search level looking at this example eg.

so the elasticSearchMapping and indexing keys belong below search, which means this field will probably not have any configuration right now.

You see… as soon as you do things right, it just works :smile:.

Thanks loads! I have been looking at this for ages, but didn’t spot that detail…

Thanks a lot!

Great :smile: