Skip to content

script_file does not work with _update #10007

Closed
@pickypg

Description

@pickypg

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"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Core/Infra/ScriptingScripting abstractions, Painless, and Mustache:Distributed Indexing/CRUDA catch all label for issues around indexing, updating and getting a doc by id. Not search.>buggood first issuelow hanging fruit

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions