Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Corner case] Script working event after disabling dynamic scripting #7816

Closed
Vineeth-Mohan opened this issue Sep 22, 2014 · 5 comments
Closed
Assignees
Labels

Comments

@Vineeth-Mohan
Copy link

On executing

{
  "size": 0,
  "aggs": {
    "sum": {
      "sum": {
        "script": "doc.score"
      }
    }
  }
}

I am seeing
{
took: 13
timed_out: false
_shards: {
total: 1
successful: 1
failed: 0
}
hits: {
total: 1946
max_score: 0
hits: [ ]
}
aggregations: {
sum: {
value: 1946
}
}
}

But on executing

{
  "size": 0,
  "aggs": {
    "sum": {
      "sum": {
        "script": "_score"
      }
    }
  }
}

I am getting - SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed; shardFailures {[OtHPQX2iRj2yhtfeBMqJgA][restaurants][0]: SearchParseException[[restaurants][0]: from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"aggs":{"sum":{"sum":{"script":"_score"}}}}]]]; nested: ScriptException[dynamic scripting for [mvel] disabled]; }]

@clintongormley
Copy link
Contributor

Hi @Vineeth-Mohan

I'm unable to replicate this on 1.3.2. Could you provide a complete standalone replication?

thanks

@Vineeth-Mohan
Copy link
Author

@clintongormley - My apologies , it was not _size , it was doc.score.
My concern was that , with scripting disabled , doc.score is working , but _score is giving "scripting disabled error".

@clintongormley
Copy link
Contributor

True, in 1.3.3, with scripting disabled:

This works:

"doc.score"

While this returns an error about disabled scripting:

"doc.score+1"

@brwe any ideas here?

@brwe
Copy link
Contributor

brwe commented Oct 15, 2014

doc.score is pre compiled always for optimization: https://github.com/elasticsearch/elasticsearch/blob/1.3/src/main/java/org/elasticsearch/script/ScriptService.java#L250 so the dynamic script check is not performed.
This is already removed in >=1.4, see #7819
It is confusing but I am unsure if it makes sense to remove it. I can do it if you think so.

@clintongormley
Copy link
Contributor

@brwe no, it's not a security issue. i'd leave it as it is, esp as it is already fixed in 1.4.

thanks for looking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants