Kibana User Guide [4.2] » Settings » Managing Fields

Managing Fields

管理字段

The fields for the index pattern are listed in a table. Click a column header to sort the table by that column. Click the Controls button in the rightmost column for a given field to edit the field’s properties. You can manually set the field’s format from the Format drop-down. Format options vary based on the field’s type.

索引模式的字段已经列举在表中。点击列头来对基于列的表排序。点击已知字段的列最右边的 Controls 按钮,来编辑列的特性。你可以从 Format 下拉菜单,手动设置字段的格式。格式选项根据字段的类型变化。

You can also set the field’s popularity value in the Popularity text entry box to any desired value. Click theUpdate Field button to confirm your changes or Cancel to return to the list of fields.

你也可以在 Popularity 文本输入框,设置字段的普遍值为任何想到的。点击 Update Field 按钮来让你的改变生效,或者 Cancel 按钮返回字段列表。

Kibana has field formatters for the following field types:

Kibana有以下类型的字段转换器:

String Field Formatters 字符串型字段转换器

String fields support the String and Url formatters.

字符串型字段转换器支持StringUrl转换。

The String field formatter can apply the following transformations to the field’s contents:

String字段转换器可以应用下面的转换到字段的内容:

  • 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: 应用点转换,可以把.前面的内容转换成内容的第一个字母,就像下面的例子:

    Original 原始的

    Becomes 转换的

    com.organizations.project.ClassName

    c.o.p.ClassName

The Url field formatter can take on the following types:  Url字段转换器可以呈现下面的类型:

  • The Link type turn the contents of the field into an URL. 链接类型把字段内容转换成URL。
  • The Image type can be used to specify an image directory where a specified image is located. 图片类型可以用于指定一个图片被加载的图片链接。

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.

你可以用样板定制URL类型的字段。URL样本使你可以增加具体的标准到URL。使用字符串{{value}}增加字段的内容到一个固定的URL。

For example, when: 例如,当:

  • A field contains a user ID 保护用户ID的字段
  • That field uses the Url field formatter 使用URL字段转换器的字段
  • The URI template is http://company.net/profiles?user_id={­{value}­} Url模板是:http://company.net/profiles?user_id={­{value}­}

The resulting URL replaces {{value}} with the user ID from the field.

最终的URL用字段中的用户ID代替 {{value}}

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 addingusers%2Fadmin.

  {{value}}模板字符串URL——编码字段的内容。当一个被编码成URL的字段,如果包含非ASCII字符,这些字符将被% character和适当的16进制代码取代。例如,字段内容users/admin最终会变为URL模板:users%2Fadmin

When the formatter type is set to Image, the {{value}} template string specifies the name of an image at the specified URI.

当一个设置类型被转换成 Image,早指定的URL,{{value}}模板字符串确定图片的名字。

In order to pass unescaped values directly to the URL, use the {{rawValue}} string.

为了把未保有的值换换成URL,使用{{rawValue}}字符串。

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.

标签模板让你确定一个文本串,而不是直接展现原始URL。你可以在一个标签模板中,正常地使用{{value}} 模板串。你也可以使用 {{url}} 模板串来展现一个格式化URL。

Date Field Formatters 日期字段转换器

Date fields support the DateUrl, and String formatters.

日期字段支持 DateUrl, 和 String 转换器。

The Date formatter enables you to choose the display format of date stamps using the moment.js standard format definitions.

日期字段保证你可以选择日期标记的展示格式,使用 moment.js 标准的格式定义。

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: 应用点转换,可以把.前面的内容转换成内容的第一个字母,就像下面的例子:

    Original

    Becomes

    com.organizations.project.ClassName

    c.o.p.ClassName

The Url field formatter can take on the following types:  Url字段转换器可以呈现下面的类型:

  • The Link type turn the contents of the field into an URL. 链接类型把字段内容转换成URL。
  • The Image type can be used to specify an image directory where a specified image is located. 图片类型可以用于指定一个图片被加载的图片链接。

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.

你可以用样板定制URL类型的字段。URL样本使你可以增加具体的标准到URL。使用字符串{{value}}增加字段的内容到一个固定的URL。

For example, when: 例如,当:

  • A field contains a user ID 保护用户ID的字段
  • That field uses the Url field formatter 使用URL字段转换器的字段
  • The URI template is http://company.net/profiles?user_id={­{value}­} Url模板是:http://company.net/profiles?user_id={­{value}­}

The resulting URL replaces {{value}} with the user ID from the field.

最终的URL用字段中的用户ID代替 {{value}}

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 addingusers%2Fadmin.

  {{value}}模板字符串URL——编码字段的内容。当一个被编码成URL的字段,如果包含非ASCII字符,这些字符将被a % character和适当的16进制代码取代。例如,字段内容users/admin最终会变为URL模板:users%2Fadmin

When the formatter type is set to Image, the {{value}} template string specifies the name of an image at the specified URI.

当一个设置类型被转换成 Image,早指定的URL,{{value}}模板字符串确定图片的名字。

In order to pass unescaped values directly to the URL, use the {{rawValue}} string.

为了把未保有的值换换成URL,使用{{rawValue}}字符串。

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.

标签模板让你确定一个文本串,而不是直接展现原始URL。你可以在一个标签模板中,正常地使用{{value}} 模板串。你也可以使用 {{url}} 模板串来展现一个格式化URL。

Geographic Point Field Formatters 地理点字段转化

Geographic point fields support the String formatter. 地理点字段支持字符串转化

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: 应用点转换,可以把.前面的内容转换成内容的第一个字母,就像下面的例子:

    Original

    Becomes

    com.organizations.project.ClassName

    c.o.p.ClassName

Numeric Field Formatters 数值字段转换

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: 应用点转换,可以把.前面的内容转换成内容的第一个字母,就像下面的例子:

    Original

    Becomes

    com.organizations.project.ClassName

    c.o.p.ClassName

The Url field formatter can take on the following types:  Url字段转换器可以呈现下面的类型:

    • The Link type turn the contents of the field into an URL. 链接类型把字段内容转换成URL。
    • The Image type can be used to specify an image directory where a specified image is located. 图片类型可以用于指定一个图片被加载的图片链接。

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.

你可以用样板定制URL类型的字段。URL样本使你可以增加具体的标准到URL。使用字符串{{value}}增加字段的内容到一个固定的URL。

For example, when: 例如,当:

  • A field contains a user ID 保护用户ID的字段
  • That field uses the Url field formatter 使用URL字段转换器的字段
  • The URI template is http://company.net/profiles?user_id={­{value}­} Url模板是:http://company.net/profiles?user_id={­{value}­}

The resulting URL replaces {{value}} with the user ID from the field.

最终的URL用字段中的用户ID代替 {{value}}

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 addingusers%2Fadmin.

  {{value}}模板字符串URL——编码字段的内容。当一个被编码成URL的字段,如果包含非ASCII字符,这些字符将被a % character和适当的16进制代码取代。例如,字段内容users/admin最终会变为URL模板:users%2Fadmin

When the formatter type is set to Image, the {{value}} template string specifies the name of an image at the specified URI.

当一个设置类型被转换成 Image,早指定的URL,{{value}}模板字符串确定图片的名字。

In order to pass unescaped values directly to the URL, use the {{rawValue}} string.

为了把未保有的值换换成URL,使用{{rawValue}}字符串。

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.

标签模板让你确定一个文本串,而不是直接展现原始URL。你可以在一个标签模板中,正常地使用{{value}} 模板串。你也可以使用 {{url}} 模板串来展现一个格式化URL。

The BytesNumber, and Percentage formatters enable you to choose the display formats of numbers in this field using the numeral.js standard format definitions.

BytesNumber, 和 Percentage 转换器让你选择数值在字段中的展现格式,使用 numeral.js 标准格式定义。

Creating a Scripted Field 创建一个脚本字段

Scripted fields compute data on the fly from the data in your Elasticsearch indices. Scripted field data is shown on the Discover tab as part of the document data, and you can use scripted fields in your visualizations. Scripted field values are computed at query time so they aren’t indexed and cannot be searched.

脚本化字段从你的 Elasticsearch 索引数据中即时计算得来。在 Discover 标签页,脚本化字段数据会作为文档数据的一部分显示,而且你还可以在可视化里使用脚本化字段。(脚本化字段的值是在请求的时候计算的,所以它们没有被索引,不能搜索到)

Warning

Computing data on the fly with scripted fields can be very resource intensive and can have a direct impact on Kibana’s performance. Keep in mind that there’s no built-in validation of a scripted field. If your scripts are buggy, you’ll get exceptions whenever you try to view the dynamically generated data.

即时计算脚本化字段非常消耗资源,会直接影响到 Kibana 的性能。而且记住,Elasticsearch 里没有内置对脚本化字段的验证功能。如果你的脚本有 bug,你会在查看动态生成的数据时看到 exception。

Scripted fields use the Lucene expression syntax. For more information, see Lucene Expressions Scripts.

脚本化字段使用 Lucene 表达式语法。更多细节,请阅读 Lucene Expressions Scripts

You can reference any single value numeric field in your expressions, for example:

你可以在表达式里引用任意单个数值类型字段,比如:

doc['field_name'].value

To create a scripted field: 要创建一个脚本化字段:

  1. Go to Settings > Indices
  2. Select the index pattern you want to add a scripted field to.
  3. Go to the pattern’s Scripted Fields tab.
  4. Click Add Scripted Field.
  5. Enter a name for the scripted field.
  6. Enter the expression that you want to use to compute a value on the fly from your index data.
  7. Click Save Scripted Field.

  1. 进入 Settings > Indices
  2. 选择你打算添加脚本化字段的索引模式。
  3. 进入模式的 Scripted Fields 标签。
  4. 点击 Add Scripted Field
  5. 输入脚本化字段的名字。
  6. 输入用来即时计算数据的表达式。
  7. 点击 Save Scripted Field.

For more information about scripted fields in Elasticsearch, see Scripting.

有关 Elasticsearch 的脚本化字段的更多细节,阅读 Scripting

Note

In Elasticsearch releases 1.4.3 and later, this functionality requires you to enable dynamic Groovy scripting.

在ES1.4.3及以后版本,这个功能要求你保证 dynamic Groovy scripting 。

Updating a Scripted Field 更新一个脚本字段

To modify a scripted field: 要更新一个脚本化字段:

  1. Go to Settings > Indices  进入 Settings > Indices
  2. Click the Edit button for the scripted field you want to change.  点击你要更新的脚本化字段的 Edit 按钮
  3. Make your changes and then click Save Scripted Field to update the field.  完成变更后点击 Save Scripted Field 升级
Warning

Keep in mind that there’s no built-in validation of a scripted field. If your scripts are buggy, you’ll get exceptions whenever you try to view the dynamically generated data.  注意 Elasticsearch 里没有内置对脚本化字段的验证功能。如果你的脚本有 bug,你会在查看动态生成的数据时看到 exception。

Deleting a Scripted Field  删除一个脚本化字段

To delete a scripted field: 方法:

  1. Go to Settings > Indice
  2. Click the Delete button for the scripted field you want to remove.
  3. Confirm that you really want to delete the field.
  1. 进入 Settings > Indices
  2. 点击你要删除的脚本化字段的 Delete 按钮。
  3. 确认你确实想删除它。

备注:
材料来自elastic官网。
参考整理:
http://kibana.logstash.es/content/kibana/v4/settings.html
原文地址:
https://www.elastic.co/guide/en/kibana/current/managing-fields.html


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值