Skip to content

Commit

Permalink
[Data views] Add composite runtime field docs with screenshots (#141013
Browse files Browse the repository at this point in the history
…) (#141558)

* add composite screenshots and docs

* add composite screenshots and docs

* add screenshots

* cleanup

* Update docs/management/manage-data-views.asciidoc

Co-authored-by: Anton Dosov <dosantappdev@gmail.com>

* Update docs/management/manage-data-views.asciidoc

Co-authored-by: Anton Dosov <dosantappdev@gmail.com>

Co-authored-by: Anton Dosov <dosantappdev@gmail.com>
(cherry picked from commit 004cb0e)

Co-authored-by: Matthew Kime <matt@mattki.me>
  • Loading branch information
kibanamachine and mattkime authored Sep 23, 2022
1 parent 3486403 commit 7c9a49b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
Binary file added docs/management/images/runtime_field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 21 additions & 4 deletions docs/management/manage-data-views.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ Return `Hello World!`:
emit("Hello World!");
----

image:management/images/runtime_field.png[Runtime field with keyword type]

[float]
[[perform-a-calculation-on-a-single-field]]
===== Perform a calculation on a single field
==== Perform a calculation on a single field

Calculate kilobytes from bytes:

Expand All @@ -90,7 +92,7 @@ emit(doc['bytes'].value / 1024)

[float]
[[return-substring]]
===== Return a substring
==== Return a substring

Return the string that appears after the last slash in the URL:

Expand All @@ -108,9 +110,24 @@ emit("");
----

[float]
[[replace-nulls-with-blanks]]
===== Replace nulls with blanks
[[composite-runtime-field]]
==== Return multiple fields with a composite runtime field

A single runtime field can also produce multiple subfields when the type `Composite` is selected. The script editor provides default types that can be customized for each subfields.

Return `keyword` and `double` type subfields. Note that the first argument for `emit` is the name of the subfield.

[source,text]
----
emit('subfield_a', 'Hello');
emit('subfield_b', 42);
----

image:management/images/runtime_field_composite.png[Runtime field with composite type]

[float]
[[replace-nulls-with-blanks]]
==== Replace nulls with blanks
Replace `null` values with `None`:

[source,text]
Expand Down

0 comments on commit 7c9a49b

Please sign in to comment.