You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Kusto查询根据URL中的分类ID获取分类名称

根据分类ID获取分类名称的Kusto查询方案

场景1:分类信息存在自定义事件(CustomEvents)中

如果应用在用户访问分类页面时,上报了包含bCatID和分类名称的自定义事件(比如命名为CategoryView),可使用以下查询:

CustomEvents
| where name == "CategoryView"
| where toint(customDimensions.bCatID) == 1282
| project CategoryName = customDimensions.CategoryName
| take 1

场景2:分类信息嵌入在请求的自定义维度(Requests表)中

如果Requests表的customDimensions字段直接存储了分类ID与名称的映射,可直接从该表提取:

Requests
| where resultCode == 200
| where toint(customDimensions.bCatID) == 1282
| project CategoryName = customDimensions.CategoryName
| summarize by CategoryName
| take 1

场景3:需从URL参数关联其他日志表

如果分类名称仅在特定页面的响应或其他日志中存在,可先提取目标分类ID的请求记录,再关联对应日志表:

// 提取所有包含bCatID=1282的有效请求
let targetRequests = Requests
| where resultCode == 200
| parse url with * "&bCatID=" bCatID:int
| where bCatID == 1282;

// 关联存储分类名称的日志表(如PageViews或自定义日志)
PageViews
| where operation_Id in (targetRequests.operation_Id)
| project CategoryName = customDimensions.CategoryName
| summarize by CategoryName
| take 1

注意事项

  • 请根据实际日志结构调整字段名(比如customDimensions中的键名可能与示例不同)
  • 若存在多份相同分类ID的记录,summarize by CategoryName可实现去重,确保返回唯一的分类名称

内容的提问来源于stack exchange,提问作者Lakshmi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 05:11:11