Painless Context Doc: Add field context example#35130
Painless Context Doc: Add field context example#35130mayya-sharipova merged 2 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/es-core-infra |
jdconrad
left a comment
There was a problem hiding this comment.
@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.
debadair
left a comment
There was a problem hiding this comment.
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. | ||
|
|
There was a problem hiding this comment.
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`: | ||
|
|
There was a problem hiding this comment.
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: | ||
|
|
There was a problem hiding this comment.
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. | ||
|
|
There was a problem hiding this comment.
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.
|
@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. |
9496981 to
f200371
Compare
relates to #34829