Custom score with distance levenstein


In first time I am sorry about my English.

I want scoring my document with only the distance levenstein.
I try to custom the Similarity but it doesn't work (i don't manage to
change the value of queryNorm)
I don't know how i can use the function_score.
So i try to extends AbstractFloatSearchScript, to do something like that.
How can i have the value of the query ?

public float runAsFloat() {
    LuceneLevenshteinDistance distance = new LuceneLevenshteinDistance


    String nomDoc = docFieldStrings("nom").getValue();
    float score = distance.getDistance(nomDoc, nomQuery);

    return score;

And I think there is a better way to do that.
I wait with pleasure for your proposals

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit