rescore

fun rescore(vararg rescores: Rescore): T

Adds rescores to the existing query rescorers. Rescoring is executed after post filter phase.

Samples

import dev.evo.elasticmagic.SearchQuery
import dev.evo.elasticmagic.aggs.HistogramAgg
import dev.evo.elasticmagic.aggs.TermsAgg
import dev.evo.elasticmagic.doc.Document
import dev.evo.elasticmagic.query.Bool
import dev.evo.elasticmagic.query.FunctionScore
import dev.evo.elasticmagic.query.MatchPhrase
import dev.evo.elasticmagic.query.MultiMatch
import dev.evo.elasticmagic.query.NodeHandle
import dev.evo.elasticmagic.query.QueryExpressionNode
import dev.evo.elasticmagic.query.QueryRescore
import dev.evo.elasticmagic.query.match

import kotlin.random.Random
fun main() { 
   //sampleStart 
   // Boost top 100 users that match a given phrase
searchQuery.rescore(
    QueryRescore(
        MatchPhrase(
            UserDoc.about,
            "brown fox",
            slop = 2,
        ),
        windowSize = 100,
        rescoreQueryWeight = 2.0F,
    )
) 
   //sampleEnd
}

See also


fun rescore(rescores: List<Rescore>): T


Clears the existing rescorers.