Skip to content

Conversation

@mayya-sharipova
Copy link
Contributor

relates to #34829

@mayya-sharipova mayya-sharipova added >docs General docs changes v6.6.0 v7.0.0 :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache labels Oct 31, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Contributor

@jdconrad jdconrad left a comment

Choose a reason for hiding this comment

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

@mayya-sharipova These are great! I'll shoot @debadair a quick ping as I'd like her to look this over from the docs side of things.

@jdconrad jdconrad mentioned this pull request Nov 1, 2018
17 tasks
Copy link
Contributor

@debadair debadair left a comment

Choose a reason for hiding this comment

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

Suggested some minor edits.


We will use two scripts to create two additional fields for each search hit.
These script fields will output computed custom information.

Copy link
Contributor

Choose a reason for hiding this comment

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

In general, I recommend sticking with the present tense and avoiding "we" except for cases where "we" means "Elastic" (particularly in cases where you're making a recommendation). In this case, I'd probably edit this to read:

You can then use these example scripts to compute custom information and output it to two new fields.

These script fields will output computed custom information.

The first script calculates the day of the week for the field `datetime`:

Copy link
Contributor

Choose a reason for hiding this comment

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

The callout below is fairly redundant. I'd remove the callout and edit the intro to read:

The first script gets the doc value for the datetime field and calls the getDayOfWeek function to determine the corresponding day of the week.


The second script calculates the number of actors. Actors' names are stored
as an array in the `actors` field:

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say "as a text array" -- then you don't have to reitrate that actors is a text field in the callout.

I'd also change the : to a . to be consistent with the punctuation above. (And the second sentence adds info, rather than really leading into the example.)

not available for this field. We parse `_source` to extract
`actors` and calculate their number. Note how `params['_source']['actors']`
is a list.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rephrase this slightly:

By default, doc values are not available for text fields. However, you can still calculate the number of actors by extracting actors from _source. Note that params['_source']['actors'] is a list.

@mayya-sharipova
Copy link
Contributor Author

@debadair Thank you for your review. I have addressed your comments the way you suggested. Can you please let me know if there is anything else that needs to be done.

@mayya-sharipova mayya-sharipova force-pushed the painless-context-field-example branch from 9496981 to f200371 Compare November 6, 2018 13:42
@mayya-sharipova mayya-sharipova merged commit 7e144b3 into elastic:master Nov 8, 2018
@mayya-sharipova mayya-sharipova deleted the painless-context-field-example branch November 8, 2018 19:54
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 v6.6.0 v7.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants