ScoreFunctionBuilder ElasticSearch 6.0


I create a ScoreFunctionBuilder in order to use for search. I add a scriptFunction which refer to a field but I want to add more than one. In ES 1.7 I can use add() function but in ES 6.0 java api I can't. Is there a way to do this?

My code is:
ScoreFunctionBuilder fb = ScoreFunctionBuilders.scriptFunction("_score * (doc['fieldName'].value!=null && doc['fieldName'].value!='null' && doc['fieldName'].value!='' ? 40000:1) ")

    BoolQueryBuilder q = buildFilter2(esc);

    SearchRequestBuilder srbPaged = client.prepareSearch(indexName)
            .setFetchSource(includes, excludes)
            .setQuery(QueryBuilders.functionScoreQuery(q, fb))

Thank you in advance!

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