[25.14 新機能]LookMLでフィールドの同義語を定義できるパラメータ「synonyms」がリリースされました

[25.14 新機能]LookMLでフィールドの同義語を定義できるパラメータ「synonyms」がリリースされました

2025.09.08

さがらです。

先日、Lookerの最新バージョンである25.14がリリースされました。

https://cloud.google.com/looker/docs/release-notes#August_13_2025

この25.14の新機能として、LookMLでフィールドの同義語を定義できるパラメータsynonymsがリリースされました。

https://cloud.google.com/looker/docs/reference/param-field-synonyms

この機能を試してみたので、この内容についてまとめてみます。

定義方法

定義方法はとても簡単で、各dimension・measureを定義する際に以下のようにsynonymsを定義すればOKです。

  dimension: customer_id {
    primary_key: yes
    type: number
    sql: ${TABLE}.customer_id ;;
    label: "顧客ID"
    synonyms: ["ID", "顧客番号"]
  }

  measure: average_number_of_orders {
    type: average
    sql: ${number_of_orders} ;;
    label: "平均注文数"
    synonyms: ["オーダーの平均", "平均オーダー数", "アベレージ"]
  }

定義後のExploreの変化

Explore上では、特にsynonymsが表示されることはありませんでした。

2025-09-08_11h31_16

この仕様は公式Docにも言及があります。

Synonyms aren't surfaced in a Looker Explore but instead appear as part of a field's metadata when you use the Looker API to get information about a LookML model.

Gemini in LookerのConversational Analyticsで質問をしてみる

実際にConversational Analyticsを使って、synonymsの効果が出ているかを確認してみます。

使用するview・Explore

以下のViewを参照するExploreを定義しておきます。

view: customers {
  sql_table_name: `production.customers`
    ;;
  drill_fields: [customer_id]
  label: "顧客"

  dimension: customer_id {
    primary_key: yes
    type: number
    sql: ${TABLE}.customer_id ;;
    label: "顧客ID"
    synonyms: ["ID", "顧客番号"]
  }

  dimension: first_name {
    type: string
    sql: ${TABLE}.first_name ;;
    label: "名"
    synonyms: ["名前 (名)", "ファーストネーム"]
  }

  dimension_group: first_order {
    type: time
    timeframes: [
      raw,
      date,
      week,
      month,
      quarter,
      year
    ]
    convert_tz: no
    datatype: date
    sql: ${TABLE}.first_order_date ;;
    label: "初回注文"
    synonyms: ["最初の注文", "初回購入"]
  }

  dimension: last_name {
    type: string
    sql: ${TABLE}.last_name ;;
    label: "姓"
    synonyms: ["名字", "苗字", "ラストネーム"]
  }

  dimension_group: most_recent_order {
    type: time
    timeframes: [
      raw,
      date,
      week,
      month,
      quarter,
      year
    ]
    convert_tz: no
    datatype: date
    sql: ${TABLE}.most_recent_order_date ;;
    label: "最終注文"
    synonyms: ["最新の注文", "最終購入"]
  }

  dimension: number_of_orders {
    type: number
    sql: ${TABLE}.number_of_orders ;;
    label: "注文数"
    synonyms: ["注文回数", "オーダー数"]
  }

  dimension: is_ordered {
    type: yesno
    sql: ${number_of_orders} != 0 ;;
    label: "注文経験あり"
    synonyms: ["購入フラグ", "注文有無"]
  }

  measure: count {
    type: count
    drill_fields: [customer_id, last_name, first_name]
    label: "顧客数"
    synonyms: ["ユーザー数", "人数", "カスタマー数"]
  }

  measure: total_number_of_orders {
    type: sum
    sql: ${number_of_orders} ;;
    label: "合計注文数"
    synonyms: ["総注文数", "オーダー数", "受注件数"]
  }

  measure: average_number_of_orders {
    type: average
    sql: ${number_of_orders} ;;
    label: "平均注文数"
    synonyms: ["オーダーの平均", "平均オーダー数", "アベレージ"]
  }

  measure: active_customer_count {
    type: count_distinct
    sql: ${customer_id} ;;
    filters: [is_ordered: "Yes"]
    label: "購入顧客数"
    synonyms: ["アクティブユーザー数", "購入者数"]
  }

  measure: max_number_of_orders {
    type: max
    sql: ${number_of_orders} ;;
    label: "最大注文数"
    synonyms: ["最多注文回数"]
  }

  measure: min_number_of_orders {
    type: min
    sql: ${number_of_orders} ;;
    filters: [is_ordered: "Yes"]
    label: "最小注文数(購入者のみ)"
    synonyms: ["最低注文回数"]
  }

  measure: new_customer_count {
    type: count
    filters: [first_order_date: "last 30 days"]
    label: "新規顧客数(直近30日)"
    synonyms: ["最近の新規ユーザー"]
  }

  measure: repeat_customer_count {
    type: count
    filters: [number_of_orders: ">1"]
    label: "リピート顧客数"
    synonyms: ["リピーター数"]
  }

  measure: percentage_of_repeat_customers {
    type: number
    sql: ${repeat_customer_count} / NULLIF(${active_customer_count}, 0) ;;
    value_format_name: percent_2
    label: "リピート率"
    synonyms: ["リピーター率"]
  }
}

Conversational Analyticsで質問をしてみる

以下のようにそれぞれ質問を行ってみました。検証に用いたViewがシンプルなことも影響があるかもしれませんが、こちらの意図に合った結果を返してくれていることがわかります。

  • 「アクティブユーザー数とリピーター数を月ごとに比較して」

2025-09-08_11h48_06

  • 「リピーター率が最も高いのは、どの初回購入月?」

2025-09-08_11h50_19

  • 「最多注文回数を記録した顧客の初回購入日はいつ?その顧客番号も教えて」

2025-09-08_11h52_31

最後に

Looker 25.14の新機能である、LookMLでフィールドの同義語を定義できるパラメータsynonymsを試してみました。

Lookerで定義したSemantic Layerを生成AIで活かすためには必須の機能だと思います!ぜひご活用ください。

この記事をシェアする

facebookのロゴhatenaのロゴtwitterのロゴ

© Classmethod, Inc. All rights reserved.