Skip to content

Commit

Permalink
[Docs] Fix script-fields snippet execution (#30693)
Browse files Browse the repository at this point in the history
Currently the first snippet in the documentation test in script-fields.asciidoc
isn't executed, although it has the CONSOLE annotation. Adding a test setup
annotation to it seems to fix the problem.
  • Loading branch information
Christoph Büscher committed May 22, 2018
1 parent 9a90762 commit 26ab4e8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/reference/search/request/script-fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ GET /_search
"test1" : {
"script" : {
"lang": "painless",
"source": "doc['my_field_name'].value * 2"
"source": "doc['price'].value * 2"
}
},
"test2" : {
"script" : {
"lang": "painless",
"source": "doc['my_field_name'].value * params.factor",
"source": "doc['price'].value * params.factor",
"params" : {
"factor" : 2.0
}
Expand All @@ -31,7 +31,7 @@ GET /_search
}
--------------------------------------------------
// CONSOLE

// TEST[setup:sales]

Script fields can work on fields that are not stored (`my_field_name` in
the above case), and allow to return custom values to be returned (the
Expand Down

2 comments on commit 26ab4e8

@Bouke
Copy link

@Bouke Bouke commented on 26ab4e8 Feb 11, 2021

Choose a reason for hiding this comment

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

This change misses the reference to my_field_name in the subsequent paragraph.

@cbuescher
Copy link
Member

Choose a reason for hiding this comment

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

Hi Bouke, thanks for noting. The current state of this doc page is already different from the state in this old PR (see e.g. https://www.elastic.co/guide/en/elasticsearch/reference/7.11/search-fields.html#script-fields)
If you think it still needs an update, we're always happy about suggestions in for of a PR. There's a handy "edit" button right on the documentation page in case you want to directly propose a change.

Please sign in to comment.