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

Put script API should be able to accept scripts not wrapped into a JSON object #19963

Closed
imotov opened this issue Aug 11, 2016 · 4 comments
Closed
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache discuss >enhancement

Comments

@imotov
Copy link
Contributor

imotov commented Aug 11, 2016

In 5.0 in order to store a script, the script needs to be wrapped into a single field json object:

curl -XPOST 'localhost:9200/_scripts/groovy/calculate-score' -d '{"script": "log(_score * 2) + my_modifier" }'

It's not bit deal for one-liners as in this example, but it makes debugging large scripts more complicated then it needs to be. It would be great if put script command accepted unwrapped scripts like this:

curl -XPOST 'localhost:9200/_scripts/groovy/calculate-score' -d 'log(_score * 2) + my_modifier'
@imotov imotov added >enhancement discuss :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache labels Aug 11, 2016
@imotov
Copy link
Contributor Author

imotov commented Aug 12, 2016

After speaking with @javanna it looks like it might be a good idea to integrate this with #19388, otherwise we will have to add even more magic into detection of the content type.

@clintongormley
Copy link
Contributor

Yeah, I'd rather stick with just the one way of doing it. The few end points which support text bodies are problematic.

@javanna
Copy link
Member

javanna commented May 5, 2017

Given the direction is to remove the existing endpoint that support plain/text rather than adding new ones, see #22751, I would close this. Do you mind @imotov ? :)

@imotov
Copy link
Contributor Author

imotov commented May 5, 2017

Makes sense!

@imotov imotov closed this as completed May 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache discuss >enhancement
Projects
None yet
Development

No branches or pull requests

3 participants