mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Adds documentation for field formatters.
This commit is contained in:
parent
b2a4844103
commit
fe0c7c5029
3 changed files with 74 additions and 0 deletions
|
@ -155,6 +155,44 @@ the field's format from the *Format* drop-down. Format options vary based on the
|
|||
You can also set the field's popularity value in the *Popularity* text entry box to any desired value. Click the
|
||||
*Update Field* button to confirm your changes or *Cancel* to return to the list of fields.
|
||||
|
||||
Kibana has field formatters for the following field types:
|
||||
|
||||
==== String Field Formatters
|
||||
|
||||
String fields support the `String` and `Url` formatters.
|
||||
|
||||
include::string-formatter.asciidoc[]
|
||||
|
||||
include::url-formatter.asciidoc[]
|
||||
|
||||
==== Date Field Formatters
|
||||
|
||||
Date fields support the `Date`, `Url`, and `String` formatters.
|
||||
|
||||
The `Date` formatter enables you to choose the display format of date stamps using the http://moment.js[moment.js]
|
||||
standard format definitions.
|
||||
|
||||
include::string-formatter.asciidoc[]
|
||||
|
||||
include::url-formatter.asciidoc[]
|
||||
|
||||
==== Geographic Point Field Formatters
|
||||
|
||||
Geographic point fields support the `String` formatter.
|
||||
|
||||
include::string-formatter.asciidoc[]
|
||||
|
||||
==== Numeric Field Formatters
|
||||
|
||||
Numeric fields support the `Url`, `String`, `Bytes`, `Number`, and `Percentage` formatters.
|
||||
|
||||
include::string-formatter.asciidoc[]
|
||||
|
||||
include::url-formatter.asciidoc[]
|
||||
|
||||
The `Bytes`, `Number`, and `Percentage` formatters enable you to choose the display formats of numbers in this field using
|
||||
the https://adamwdraper.github.io/Numeral-js/[numeral.js] standard format definitions.
|
||||
|
||||
[float]
|
||||
[[create-scripted-field]]
|
||||
=== Creating a Scripted Field
|
||||
|
|
10
docs/string-formatter.asciidoc
Normal file
10
docs/string-formatter.asciidoc
Normal file
|
@ -0,0 +1,10 @@
|
|||
The `String` field formatter can apply the following transformations to the field's contents:
|
||||
|
||||
* Convert to lowercase
|
||||
* Convert to uppercase
|
||||
* Apply the short dots transformation, which replaces the content before a `.` character with the first character of
|
||||
that content, as in the following example:
|
||||
|
||||
[horizontal]
|
||||
*Original*:: *Becomes*
|
||||
`com.organizations.project.ClassName`:: `c.o.p.ClassName`
|
26
docs/url-formatter.asciidoc
Normal file
26
docs/url-formatter.asciidoc
Normal file
|
@ -0,0 +1,26 @@
|
|||
The `Url` field formatter can take on the following types:
|
||||
|
||||
* The *Link* type turn the contents of the field into an URL.
|
||||
* The *Image* type can be used to // what?
|
||||
|
||||
You can customize either type of URL field formats with templates. A _URL template_ enables you to add specific values
|
||||
to a partial URL. Use the string `{{value}}` to add the contents of the field to a fixed URL.
|
||||
|
||||
For example, when:
|
||||
|
||||
* A field contains a user ID
|
||||
* That field uses the `Url` field formatter
|
||||
* The URI template is `http://company.net/profiles?user_id={{value}}`
|
||||
|
||||
The resulting URL replaces `{{value}}` with the user ID from the field.
|
||||
|
||||
The `{{value}}` template string URL-encodes the contents of the field. When a field encoded into a URL contains
|
||||
non-ASCII characters, these characters are replaced with a `%` character and the appropriate hexadecimal code. For
|
||||
example, field contents `users/admin` result in the URL template adding `users%2Fadmin`.
|
||||
|
||||
In order to pass unescaped values directly to the URL, use the `{{rawValue}}` string.
|
||||
|
||||
A _Label Template_ enables you to specify a text string that displays instead of the raw URL. You can use the
|
||||
`{{value}}` template string normally in label templates. You can also use the `{{url}}` template string to display
|
||||
the formatted URL
|
||||
//why would you do this since the use case for label templates is to replace the formatted URL in display entirely?
|
Loading…
Add table
Add a link
Reference in a new issue