gpt4 book ai didi

keen-io - 我如何使用 Keen IO 显示每个用户的最新事件?

转载 作者:行者123 更新时间:2023-12-01 14:55:31 27 4
gpt4 key购买 nike

假设您有一个名为“survey-completed”的 Keen IO 集合,其中包含与以下模式匹配的事件:

keen.id: <unique autogenerated id>
keen.timestamp: <autogenerated overridable timestamp>
userId: <hex string for user>
surveyScore: <integer from 1 to 10>
...

您将如何为在给定时间(例如一周)内响应一项或多项调查的每位用户创建一份最新满意度分数的报告?

最佳答案

没有一种真正优雅的方法来实现它,但是对于给定的 userId,您可以成功返回最新的事件创建一个 count 使用 group_by 查询关于 [surveyScore, keen.timestamp] 和 order_bykeen.timestamp 属性上。您将要设置 limit =1 仅选择最近的 surveyScore

如果您想使用 extraction ,最直接的方法是在 property_names 设置为 ["userId","keen.timestamp","surveyScore"] 的情况下运行提取。收到结果后,您可以进行一些客户端后处理。如果您想查看所有 userId,这可能是最好的方法。

如果您对给定的 userId 感兴趣并想使用提取,您可以在 userId eq X< 上使用过滤器运行提取,定义可选参数latest设置为latest=1latest 属性是一个整数,其中包含要提取的最近事件的数量。注意:使用 latest 将调用 keen.created_at 时间戳而不是 keen.timestamp ( https://keen.io/docs/api/#the-keen-object )。

关于keen-io - 我如何使用 Keen IO 显示每个用户的最新事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47145382/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com