20 lines
744 B
Plaintext
20 lines
744 B
Plaintext
[[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",subs="attributes,callouts,macros"]
|
|
--------------------------------------------------
|
|
include-tagged::{query-dsl-test}[function_score]
|
|
--------------------------------------------------
|
|
<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
|