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

Fix example in documentation for Painless using _source #21322

Merged
merged 1 commit into from
Mar 16, 2017

Conversation

jdconrad
Copy link
Contributor

@jdconrad jdconrad commented Nov 3, 2016

As the title says.

@@ -50,7 +50,7 @@ GET /_search
},
"script_fields" : {
"test1" : {
"script" : "_source.obj1.obj2"
"script" : "params._source.obj1.obj2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh! If you add // TEST[setup:twitter] then below // CONSOLE on this page then we'll actually try an execute the script which might be nice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do... do you mind pointing me to an existing example? Thanks in advance.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a look at misc.asciidoc. That shows both that you can just execute some code (top snippet) and that you can execute some code and check the results (bottom two snippets together).

@nik9000 nik9000 removed the :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache label Nov 4, 2016
@clintongormley clintongormley added >docs General docs changes and removed >bug labels Nov 4, 2016
@jdconrad jdconrad closed this Feb 21, 2017
@jdconrad jdconrad deleted the docfix branch February 21, 2017 18:40
@jdconrad jdconrad restored the docfix branch March 15, 2017 23:49
@jdconrad
Copy link
Contributor Author

Oops! Let this one slip through the cracks. Going to finish it now.

@jdconrad jdconrad removed the v5.0.3 label Mar 16, 2017
Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

extract specific elements to be returned from it (can be an "object"
type). Here is an example:
Script fields can also access the actual `_source` document and
extract specific elements to be returned from it by using `params._source`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this to params['_source']?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed.

@jdconrad jdconrad merged commit 4c11ebc into elastic:master Mar 16, 2017
@jdconrad
Copy link
Contributor Author

@rjernst Thanks for the review!

jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Mar 17, 2017
* master:
  Clear the interrupt flag before joining
  Migrate to max line length of 100
  Docs: Corrected path to elasticsearch-plugin (elastic#23622)
  Docs: Add comma to reverse nested agg snippet
  Fix third-party audit task for Gradle 3.4 (elastic#23612)
  Adapter action future should restore interrupts
  Update scripting.asciidoc
  Unmark reindex as experimental
  CompletionSuggestionContext#toQuery() should also consider text if prefix/regex missing (elastic#23451)
  Docs: Specify that byte units use powers of 1024 (elastic#23574)
  Remove Settings.settingsBuilder (elastic#23575)
  Change params._source to params['_source'] in example.
  Fix example in documentation for Painless using _source. (elastic#21322)
  Remove extra line from license header
  Fix num docs to be positive in bucket deferring collector test
  Mapping: Fix NPE with scaled floats stats when field is not indexed (elastic#23528)
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Mar 17, 2017
* single-node-discovery:
  Clear the interrupt flag before joining
  Migrate to max line length of 100
  Docs: Corrected path to elasticsearch-plugin (elastic#23622)
  Docs: Add comma to reverse nested agg snippet
  Fix third-party audit task for Gradle 3.4 (elastic#23612)
  Adapter action future should restore interrupts
  Update scripting.asciidoc
  Unmark reindex as experimental
  CompletionSuggestionContext#toQuery() should also consider text if prefix/regex missing (elastic#23451)
  Docs: Specify that byte units use powers of 1024 (elastic#23574)
  Remove Settings.settingsBuilder (elastic#23575)
  Change params._source to params['_source'] in example.
  Fix example in documentation for Painless using _source. (elastic#21322)
  Remove extra line from license header
  Fix num docs to be positive in bucket deferring collector test
  Mapping: Fix NPE with scaled floats stats when field is not indexed (elastic#23528)
@jdconrad jdconrad deleted the docfix branch May 11, 2017 16:27
@clintongormley clintongormley added :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache and removed :Plugin Lang Painless labels Feb 14, 2018
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 >docs General docs changes v5.0.3 v5.1.3 v5.2.3 v5.3.1 v5.4.0 v6.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants