Hibernate Search: Unknown field 'taskId' while searching and sorting

We are searching data but while sorting (after search) getting below exception.
Not sure why HS 6 giving Unknown field ‘taskId’ while sort.
Here is code snippet something like this

@Id
@Column(name = Task.ID_COL, length = 36)
@GeneratedValue(generator = "uuid")
@GenericGenerator(
            name = "uuid",
            strategy = "uuid2"
            )
@org.hibernate.annotations.Type(type = "uuid-char")
    private UUID taskId;

==============

@Override
    protected SearchSort createSort(final SearchSortFactory sf) {
        return  sf.field("somefieldName_sort").then().field("taskId").toSort();
    }
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH400504: Unknown field 'taskId'.
Context: indexes [com.xxx.xxx.model.task.2]
        at org.hibernate.search.backend.elasticsearch.scope.model.impl.ElasticsearchScopeSearchIndexesContext.field(ElasticsearchScopeSearchIndexesContext.java:99)
        at org.hibernate.search.backend.elasticsearch.search.sort.impl.ElasticsearchSearchSortBuilderFactoryImpl.field(ElasticsearchSearchSortBuilderFactoryImpl.java:42)
        at org.hibernate.search.engine.search.sort.dsl.impl.FieldSortOptionsStepImpl.<init>(FieldSortOptionsStepImpl.java:35)
        at org.hibernate.search.engine.search.sort.dsl.impl.DefaultSearchSortFactory.field(DefaultSearchSortFactory.java:47)
        at com.xxx.xxx.model.search.TaskSearchService.createSort(TaskSearchService.java:58)
      

For anyone who ended up here and didn’t find the answer to their question, make sure you add @GenericField(sortable=Sortable.YES) to the field

Imports

import org.hibernate.search.engine.backend.types.Sortable;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;

Yes, entity properties must be mapped to index fields explicitly and, on contrary to Hibernate Search 5, in Hibernate Search 6 the document ID is no longer an index field.