Hi!
I'm using Elasticsearch and search UI and wish to sort by different fields.
I'm using the search UI component "Sorting" as follows:
<Sorting
label={"Sort by"}
sortOptions={[
{
name: "Relevance",
value: "",
direction: ""
},
{
name: "Total",
value: "total",
direction: "asc"
},
{
name: "Duration",
value: "duration",
direction: "asc"
},
{
name: "Date",
value: "date",
direction: "asc"
}
]}
/>
For Relevance, Total and Duration I get the correct results when selecting the sorting option on the UI but when selecting the Date option I get the error: "No mapping found for [date.keyword] in order to sort on".
The four fields were declared in the same way and all the results have a Date field, maybe it's a date format issue?
I also tried to do it manually by using withSearch and the setSort option but couldn't make it work and didn't find an example of how it should be used.
this.setSort({
sortField: "date",
sortDirection: "asc",
})
Can someone help me figure out how to fix this issue?
Thank you very much in advance!