function-score-query.asciidoc 744 B

12345678910111213141516171819
  1. [[java-query-dsl-function-score-query]]
  2. ==== Function Score Query
  3. See {ref}/query-dsl-function-score-query.html[Function Score Query].
  4. To use `ScoreFunctionBuilders` just import them in your class:
  5. [source,java]
  6. --------------------------------------------------
  7. import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.*;
  8. --------------------------------------------------
  9. ["source","java",subs="attributes,callouts,macros"]
  10. --------------------------------------------------
  11. include-tagged::{query-dsl-test}[function_score]
  12. --------------------------------------------------
  13. <1> Add a first function based on a query
  14. <2> And randomize the score based on a given seed
  15. <3> Add another function based on the age field