[[java-query-dsl-function-score-query]]
==== Function Score Query

See {ref}/query-dsl-function-score-query.html[Function Score Query].

To use `ScoreFunctionBuilders` just import them in your class:

[source,java]
--------------------------------------------------
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.*;
--------------------------------------------------

[source,java]
--------------------------------------------------
QueryBuilder qb = functionScoreQuery()
    .add(
        matchQuery("name", "kimchy"),             <1>
        randomFunction("ABCDEF")                  <2>
    )
    .add(
        exponentialDecayFunction("age", 0L, 1L)   <3>
    );
--------------------------------------------------
<1> Add a first function based on a query
<2> And randomize the score based on a given seed
<3> Add another function based on the age field