Mvel has been removed in recent versions of Elasticsearch due to security
issues. Either change your script to use Groovy (preferred) or install the
mvel plugin.

Cheers,

Ivan
 On Oct 29, 2014 2:44 PM, "Manuel Sciuto" <msci...@viajeros.com> wrote:

> Hello everyone
>
>
> Do not understand why it does not work
>
> # Create some docs
> PUT /searchtube/video/1
> {
>   "title": "Sick Sad World: Cold Breeze on the Interstate",
>   "description": "Is your toll collector wearing pants, a skirt, or
> nothing but a smile? Cold Breeze on the Interstate, next on Sick, Sad
> World.",
>   "views": 500,
>   "likes":2,
>   "created_at": "2014-04-22T08:00:00"
> }
>
> PUT /searchtube/video/2
> {
> "title": "Sick Sad World: The Severed Pianist",
>   "description": "When he turned up his nose at accordion lessons, they
> cut off his inheritance molto allegro. The Severed Pianist, next on Sick,
> Sad World.",
>   "views": 6000,
>   "likes": 100,
>   "created_at": "2014-04-22T12:00:00"
> }
>
> #SEARCH FUCNTION_SCORE
> GET /searchtube/_search
> {
>   "query": {
>     "function_score": {
>       "query": {"match": {"_all": "severed"}},
>       "script_score": {
>         "script": "_score * log(doc['likes'].value + doc['views'].value +
> 1)"
>       }
>     }
>   }
> }
>
>
> Error Response
>
> {
>    "error": "SearchPhaseExecutionException[Failed to execute phase
> [query], all shards failed; shardFailures
> {[vrJl1dg1RV2wqGZ2Hqv3zQ][searchtube][0]:
> SearchParseException[[searchtube][0]: from[-1],size[-1]: Parse Failure
> [Failed to parse source [{\n  \"query\": {\n    \"function_score\": {\n
>  \"query\": {\"match\": {\"_all\": \"severed\"}},\n      \"script_score\":
> {\n        \"script\": \"_score * log(doc['likes'].value +
> doc['views'].value + 1)\"\n      }\n    }\n  }\n}\n]]]; nested:
> QueryParsingException[[searchtube] script_score the script could not be
> loaded]; nested: ScriptException[dynamic scripting for [mvel] disabled];
> }{[vrJl1dg1RV2wqGZ2Hqv3zQ][searchtube][1]:
> SearchParseException[[searchtube][1]: from[-1],size[-1]: Parse Failure
> [Failed to parse source [{\n  \"query\": {\n    \"function_score\": {\n
>  \"query\": {\"match\": {\"_all\": \"severed\"}},\n      \"script_score\":
> {\n        \"script\": \"_score * log(doc['likes'].value +
> doc['views'].value + 1)\"\n      }\n    }\n  }\n}\n]]]; nested:
> QueryParsingException[[searchtube] script_score the script could not be
> loaded]; nested: ScriptException[dynamic scripting for [mvel] disabled];
> }{[vrJl1dg1RV2wqGZ2Hqv3zQ][searchtube][2]:
> SearchParseException[[searchtube][2]: from[-1],size[-1]: Parse Failure
> [Failed to parse source [{\n  \"query\": {\n    \"function_score\": {\n
>  \"query\": {\"match\": {\"_all\": \"severed\"}},\n      \"script_score\":
> {\n        \"script\": \"_score * log(doc['likes'].value +
> doc['views'].value + 1)\"\n      }\n    }\n  }\n}\n]]]; nested:
> QueryParsingException[[searchtube] script_score the script could not be
> loaded]; nested: ScriptException[dynamic scripting for [mvel] disabled];
> }{[vrJl1dg1RV2wqGZ2Hqv3zQ][searchtube][3]:
> SearchParseException[[searchtube][3]: from[-1],size[-1]: Parse Failure
> [Failed to parse source [{\n  \"query\": {\n    \"function_score\": {\n
>  \"query\": {\"match\": {\"_all\": \"severed\"}},\n      \"script_score\":
> {\n        \"script\": \"_score * log(doc['likes'].value +
> doc['views'].value + 1)\"\n      }\n    }\n  }\n}\n]]]; nested:
> QueryParsingException[[searchtube] script_score the script could not be
> loaded]; nested: ScriptException[dynamic scripting for [mvel] disabled];
> }{[vrJl1dg1RV2wqGZ2Hqv3zQ][searchtube][4]:
> SearchParseException[[searchtube][4]: from[-1],size[-1]: Parse Failure
> [Failed to parse source [{\n  \"query\": {\n    \"function_score\": {\n
>  \"query\": {\"match\": {\"_all\": \"severed\"}},\n      \"script_score\":
> {\n        \"script\": \"_score * log(doc['likes'].value +
> doc['views'].value + 1)\"\n      }\n    }\n  }\n}\n]]]; nested:
> QueryParsingException[[searchtube] script_score the script could not be
> loaded]; nested: ScriptException[dynamic scripting for [mvel] disabled];
> }]",
>    "status": 400
> }
>
>
>
> What is this doing wrong? It is an example that I found in
> https://www.found.no/foundation/function-scoring/
>
> --
> 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 elasticsearch+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/93f73abd-61b1-4569-bc2a-10b526e08b81%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/93f73abd-61b1-4569-bc2a-10b526e08b81%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQB8KNZrKqPhAhUqzTL0GOKbaNO6fNjvZHDdMa08CV%2Bdfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to