Thank you very much !!! 

How do you recommend that I do my script_score?

El sábado, 1 de noviembre de 2014 13:02:13 UTC-3, Ryan Ernst escribió:
>
> The root cause of the error is here:
> "ScriptException[dynamic scripting for [mvel] disabled]; "
>
> I would guess you are running on ES 1.2 or 1.3? Dynamic scripting was 
> disabled by default in 1.2, and for non sandboxed languages in 1.3.  In 
> 1.4, the default script language was changed to Groovy, which is sandboxed, 
> and thus can be safely compiled dynamically.
>
> See this blog for more details:
> http://www.elasticsearch.org/blog/scripting-security/
>
> If running in 1.3, you can simply change the language of the script:
> GET /searchtube/_search
> {
>  "query": {
>    "function_score": {
>      "query": {"match": {"_all": "severed"}},
>      "script_score": {
>        "script": "_score * log(doc['likes'].value + doc['views'].value + 
> 1)",
>        "lang": "groovy"
>      }
>    }
>  }
> }
>
> Although you could also use the "expr" lang (expressions) for this simple 
> script, which will be much faster!
>
> On Wednesday, October 29, 2014 11:44:07 AM UTC-7, Manuel Sciuto 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/cba0a627-ebfb-4895-924f-84d1be7f81ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to