LoginSignup
3
3

More than 3 years have passed since last update.

Elastic Stack 7.6.0リリース記念 KibanaでNested Fieldがサポートされた件

Last updated at Posted at 2020-02-12

KibanaでNested Fieldがサポートされた件

Elastic Stack 7.6.0がリリースされ、KibanaではNested Fieldがサポートされるという機能改良が入っていました。

The ability to use nested fields as part of an analysis inside of Kibana is one of the most commented on issues in the Kibana repo and today we are pleased to introduce our first steps towards helping you accomplish that goal by introducing nested field support in the search bar and filters.

「まず最初のステップとして、サーチバー、フィルターでNested Fieldがサポートされる」と書かれていますね。

これがどういうことなの? ということを確認して参りたい、と。そういう内容です。

事前準備

Mapping定義

userというNestするフィールドを用意し、その下にlast, firstというテキスト型のフィールドを持つマッピングとします。

PUT v760
{
  "mappings": {
    "properties": {
      "user": {
        "type": "nested",
        "properties": {
          "last": {
            "type": "text"
          },
          "first": {
            "type": "text"
          }
        }
      }
    }
  }
}

テストデータ

テストデータとして、以下のようなものを使用します。

POST v760/_doc/1
{
  "@timestamp": "2020-02-12T00:00:00.000Z",
  "user": [
    {
      "last": "トム",
      "first": "クルーズ"
    },
    {
      "last": "トム",
      "first": "ハンクス"
    },
    {
      "last": "ウィル",
      "first": "スミス"
    }
  ]
}

Dashboardでの見え方

Nested Fieldの表示

userフィールドにマウスカーソルを合わせると、Nested Fieldと表示され、アイコンとして[…]のようなものが表示されるようになっています。

image.png

画面全体としては、このように表示されます。

image.png

7.5.2の場合は、以下のように表示されており、?というアイコンです。

image.png

Search Barでの検索

KQLというクエリをサーチバーで書くわけですが、lastがトムのものを検索したい場合は、このように書くことができます。

user: {last: トム}

image.png

トム クルーズを検索したいのであれば、このように書けます。

user: {last: トム and first: クルーズ}

7.5.2の場合、userのあとにドットを打つと、lastやfirstが候補として表示されるので、user.last: トム とすると検索できるかも?
と思ってしまうところですが、実際はこれだと検索できません。

user.last: トム

image.png

Filterでの指定

フィルターでの条件指定は、SearchBarと異なり、いつも通りにFieldを選び、Operatorを選択して値を入れるだけですので、
ここは以前のバージョンとUX上、変わりないと見ました。

image.png

参考情報

Kibana Language Query(KQL)のドキュメントはこちら

では、みなさま良いElasticライフを。

3
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3