Scripts in elastic search gives error

hello,
I am using ES 2.3 on my system and create index on ES using sense

PUT my_index/my_type/1
{
"my_field": 5
}

and now i using script to search data

GET my_index/_search
{
"script_fields": {
"my_field": {
"script": {
"lang": "expression",
"source": "doc['my_field'] * multiplier",
"params": {
"multiplier": 2
}
}
}
}
}

but it gives me error

{

"error": {
"root_cause": [
{
"type": "script_parse_exception",
"reason": "unexpected field [source]"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "my_index",
"node": "u0TrOlcjT0yyMYIEPl1nwQ",
"reason": {
"type": "script_parse_exception",
"reason": "unexpected field [source]"
}
}
]
},
"status": 500
}

The source key was added in 5.6. In 2.4, you need to use inline.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.