I'm trying to make a script that can modify my score. So I made this:
if (!(doc['score_mod'].empty)) {
_score * doc['score_mod'].value
}
but now I have a type called web_page that doesn't have the score_mod value and it's being generated via: https://github.com/codelibs/elasticsearch-river-web . So I can't mannually put the value in when it's being genereated.
Is there a way that I could have a static score for the web_page or have the groovy script check if that value exists?
The current code fails for the web_pages results, but for the ones with a score_mod value it works just fine
_score * (doc['score_mod']?.value ?: 1)so it will default to 1 ifscore_modis missing (or consideredfalse)