-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Painless Context Doc: Add field context example #35130
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
Painless Context Doc: Add field context example #35130
Conversation
|
Pinging @elastic/es-core-infra |
jdconrad
left a comment
There was a problem hiding this 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.
debadair
left a comment
There was a problem hiding this 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. | ||
|
|
There was a problem hiding this comment.
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`: | ||
|
|
There was a problem hiding this comment.
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: | ||
|
|
There was a problem hiding this comment.
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. | ||
|
|
There was a problem hiding this comment.
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.
|
@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