Sorting with variable names instead of fixed fields


(Vandana Chadha) #1

Sorting with a specified fieldname works. But Is there any way I can use a variable name to provide the sorting field. For example:

This works:
"sort": [

   {

     "venue.price": {
       "order": "asc",
       "missing" : "_last"

}
}

BUT this below doesnt:
let varsort="venue.price";

"sort": [

   {

     "field":varsort,
       "order": "asc",
       "missing" : "_last"

     

   }
  }

Above gives me error No enum constant org.elasticsearch.search.sort.SortOrder.VENUE.PRICE.TIER"
I have tried replacing "field" with "by", same problem.


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.