Hi all, I’m trying to change the `default_sorting...
# community-help
a
Hi all, I’m trying to change the
default_sorting_field
of an existing collection to
"id"
. The reason is: I want to enable sorting on my custom field
sku
, but as far as I understand, I need to drop and re-add the field to set
sort: true
. Since I have a production website with hundreds of thousands of documents, reindexing would take a lot of time and isn't ideal. As a workaround, I was wondering if I can set the
default_sorting_field
to
"id"
instead. Is there a way to update this without recreating the entire collection? Any suggestions or best practices would be greatly appreciated! Thanks in advance!
1
f
You cannot set the
id
field as a sortable field. You'll have to create an Alias, point the alias to the original collection, create a new one, index the documents there, update the Alias to point to the new collection, and drop the old one
a
Thanks a lot for the response. It's a great solution.