I use the the elastic search's script_score to get the value of a long type field by using the doc['field_name'] syntax`,while the query action throw a exception. the query syntax and the detail of the exception is as below:
curl -XPOST http://211.159.155.44:9200/iktest/item/_search?pretty -d'
{
"query": {
"function_score": {
"query": {
"match": {
"content": "likaifu"
}
},
"functions": [
{
"gauss": {
"date": {
"offset": "0d",
"scale": "5d"
}
}
},
{
"script_score": {
"script": {
"lang": "expression",
"inline": "doc['score'].value"
}
}
}
],
"score_mode": "multiply",
"boost_mode": "replace"
}
}
}
'
"caused_by" : {
"type" : "query_shard_exception",
"reason" : "script_score: the script could not be loaded",
"index_uuid" : "jVYGC8-jTpCCyZJi-VJtmA",
"index" : "iktest",
"caused_by" : {
"type" : "script_exception",
"reason" : "compile error",
"caused_by" : {
"type" : "parse_exception",
"reason" : "unexpected character '[' on line (1) position (3)",
"caused_by" : {
"type" : "lexer_no_viable_alt_exception",
"reason" : null
}
},
"script_stack" : [
"doc[score].value",
" ^---- HERE"
],
"script" : "doc[score].value",
"lang" : "expression"
}
}