I am using App Search to fetch the results from index. When I have a root level fields, I can easily able to sort the documents. However, recently there is requirement to sort based on the nested object field and nested object is an array of objects. Hence, there is also a need to filter the nested object to get the right one to include in the sort scope. I could build this in the regular Elasticsearch query, however I am trying to find if there a way to achieve this using App Search. When I try to sort by nested field here is the error I get back:
"Sort contains a field that is not sortable: prices.value"
Hi @Pradeep_Renukaiah !
I'm afraid sorting is part of the nested field limitations for App Search. You can't sort based on nested fields.
You can issue an Elasticsearch query using the Elasticsearch Search API.
You can retrieve the equivalent Elasticsearch query that App Search does using the Search Explain API, so you can modify it accordingly before using the Elasticsearch Search API.
I hope that helps!
Thanks @Carlos_D for the details. I understand the current limitations, while I work around this issue for now, is this something that will be supported in the upcoming releases? As good amount of retailers will have some complex needs that would require nested fields based faceting or sorting.
There are no short term plans for working on this specific issue. I'd recommend looking into the above workarounds, or using Search Applications as an alternative for building a search experience.
Yeah, sure, I will review Search Applications and see if I can use templates and scripts to achieve our use cases. Thanks for the details again.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.