Try this import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder;
import java.util.Arrays; import static org.elasticsearch.client.Requests.searchRequest; import static org.elasticsearch.index.query.FilterBuilders.termsFilter; import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.factorFunction; import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource; public class FunctionScoreTest { public void testFunctionScore() { SearchRequest searchRequest = searchRequest() .source(searchSource().query(new FunctionScoreQueryBuilder(matchQuery("party_id", "12")) .add(termsFilter("course_cd", Arrays.asList("writ100", "writ112", "writ113")), factorFunction(3.0f)))); } } Jörg On Tue, Jun 10, 2014 at 11:16 AM, Jayanth Inakollu <ibsjayanth2...@gmail.com > wrote: > I need to implement the below function_score query using Java APIs. I > couldn't find any official documentation for function_score query in the > Java API section of elasticsearch > > "function_score": { > "functions": [ > { > "boost_factor": "3", > "filter": { > "terms" : {"course_cd" : ["writ100", "writ112", "writ113" > ] } > } > } > ], > "query": { > "match" : { > "party_id" : "12" > } > } > } > > Please help! > > -- > 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/56d92aab-a4d7-4757-9441-f248c5296b3c%40googlegroups.com > <https://groups.google.com/d/msgid/elasticsearch/56d92aab-a4d7-4757-9441-f248c5296b3c%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAKdsXoHBk2_PtoJkriZrvA-1B7vqB%3DhSLnaXOwFEkgeugsOZsQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.