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)