2015-06-24 17:27:19 -04:00
|
|
|
[[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.*;
|
|
|
|
--------------------------------------------------
|
|
|
|
|
2017-05-02 13:00:56 -04:00
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
2015-06-24 17:27:19 -04:00
|
|
|
--------------------------------------------------
|
2017-05-02 13:00:56 -04:00
|
|
|
include-tagged::{query-dsl-test}[function_score]
|
2015-06-24 17:27:19 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<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
|