I would like to turn an arbitrary JsonObject (which presumably follows the 
Search/Sort DSL into a SortBuilder which can then be passed to the 
SearchRequestBuilder::addSort.

I've gotten this to work by simple parsing the JsonObject myself and 
calling the appropriate calls in the SortBuilder, but that means that I 
have to implement the parsing for every variation of the DSL.

If I've got a Java JsonObject that looks like:

{
   "first_name": "asc"
}

OR

{
  "first_name": {
    "order": "asc"
  }
}

OR

{
  "_geo_distance":{
    "my_position":{
      "order": "asc"
    }
  }
}

All of which are valid Json for the sort, I would imagine there's a way to 
call:

JsonObject sort_json = <EXAMPLE FROM ABOVE>
SortBuilder sort = new SortBuilder()
sort.setSort(sort_json);

I'm almost certain I'm missing something but can't for the life of me 
figure out how to do it.

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/c09c4e67-68fe-4552-9161-eca139264511%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to