Elasticsearch Java API Function Score Query with script function

Viewed 4336

I am currently trying to build this function score query with the Java API of elasticsearch:

"query": {
"function_score": {
  "query": {
    "query_string": {
      "query": " ( ((Feild1:\"KeyWord\"^100)  OR (Feild2:\"KeyWord\"^50) ))",
      "default_operator": "and"
    }
  },
  "boost_mode": "replace",
  "script_score": {
    "script": "_score * doc [ 'calc_feild'].value"
  }
}

But I can't find any documentation regarding the java api and the function score queries. This is what I have so far:

So far I realized it

searchParam = ((Feild1:\"KeyWord\"^100)  OR (Feild2:\"KeyWord\"^50))
searchBulider.setQuery(new FunctionScoreQueryBuilder(QueryBuilders.queryString(searchParam).defaultOperator(Operator.AND)).boostMode("replace"));

query

"query" : {
"function_score" : {
  "query" : {
    "query_string" : {
      "query" : " (  ((Feild1:\"KeyWord\"^100)  OR (Feild2:\"KeyWord\"^50) ) )",
      "default_operator" : "and"
    }
  },
  "functions" : [ ],
  "boost_mode" : "replace"
}

I do not know the method in the future And the next question is how I can provide to functions in the FunctionScore Builder

Function empty?

thank you

1 Answers
Related