I have a simple query:
{
"size": 10,
"_source": "email_id",
"query": {
"function_score": {
"query": {
"bool": {
"must": {
"match_phrase": {
"message": {
"query": "female"
}
}
}
}
},
"functions": [
{
"script_score": {
"script": {
"source": "Math.log(_score + 1)"
}
}
}
]
}
}
}
And I get this error:
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"NaN",
"^---- HERE"
],
"script": "NaN",
"lang": "painless"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
}
If I remove function Math.log, the query will work. If I put any number inside Math.log, it works too. What is wrong?