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

script_file does not work with _update #10007

Closed
pickypg opened this issue Mar 5, 2015 · 3 comments
Closed

script_file does not work with _update #10007

pickypg opened this issue Mar 5, 2015 · 3 comments
Labels
>bug :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. good first issue low hanging fruit

Comments

@pickypg
Copy link
Member

pickypg commented Mar 5, 2015

Running with 1.4.4, when trying to update an existing document, one cannot use the undocumented script_file because it complains of a validation error (expecting "script" or "doc").

POST /test/type/1/_update
{
  "script_file" : "AddTag",
  "lang": "groovy",
  "params": {
    "tag": "tag5"
  }
}

Fails due to:

{
   "error": "ActionRequestValidationException[Validation Failed: 1: script or doc is missing;]",
   "status": 400
}

As a workaround, you can supply the script file directly using the script parameter (even with dynamic scripting disabled for Groovy because it recognizes that it is a file).

POST /test/type/1/_update
{
  "script" : "AddTag",
  "lang": "groovy",
  "params": {
    "tag": "tag5"
  }
}
@pickypg pickypg added >bug good first issue low hanging fruit :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache labels Mar 5, 2015
@colings86
Copy link
Contributor

@pickypg This should be fixed from 1.4.5 onwards with the addition of the ScriptParameterParser. would you be able to run the same test on the HEAD of the 1.4 branch an confirm?

@lmenezes
Copy link
Contributor

@colings86 I ran into the same issue today, and with latest from 1.4 branch it works correctly.
For previous version of 1.4, sending the script_file parameter on the URL also works. Problem was just that while reading the body, the scirpt_file parameter was missing.

@javanna
Copy link
Member

javanna commented Mar 20, 2015

I think we can close this, I added version labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. good first issue low hanging fruit
Projects
None yet
Development

No branches or pull requests

5 participants