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:
{
"errors": [
"Sort contains a field that is not sortable: prices.value"
]
}
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.
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.