Need help to build ScriptSortBuilder scriptSort using java api

Hi ,

I'm new to E_S ,and using from last 2 weeks with version 5.3 with java api.
I'm stuck in one place where i need t sort based on custom fields.
below is what i'm trying

String script = 'doc[provider_name].value == null ? doc[location_name].value == null ? 0: 1 : 0'
ScriptSortBuilder sortScript = SortBuilders.scriptSort(new Script(script), 'string')

SearchResponse searchResponse = searchConfig.getSearchClient()
.prepareSearch(id)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(queryBuilder)

    .addSort(sortScript.order(SortOrder.DESC )).

but getting runtime exception that SortBuilders.scriptSort won't take String ,String as a parameters, that i got it but i'm not able to create the Script object with script.

Thanks in Adv

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