如何根据 Aerospike 上的某些模式过滤掉键?

问题描述 投票:0回答:1

我在命名空间中有数百万条关于 aerospike 的记录:set

keys are in this format: lastname/firstname/state/zip

example:
smith/john/fl/32817
smith/carla/tn/45125
brown/chris/tn/45125

我想得到所有与模式匹配的钥匙 "*/chris/*/45125" 或其他一些模式并且想要执行一些 对这些结果键的操作。

我可以扫描所有以获取所有记录并将模式与键匹配,但这会非常耗时。我看过不同的帖子,但找不到解决方案。我怎样才能做到这一点?

aerospike
1个回答
0
投票

根据:https://discuss.aerospike.com/t/how-to-apply-regex-search-on-primary-index-using-aerospike-golang-client/9909(最初是针对 Golang 但原理是一样的):

“使用表达式,可以对键进行正则表达式搜索,但是作为 @meher 说,您必须将密钥存储在服务器上。你也可以 通过

sendKey
设置为 true 存储它,或者您也可以存储在记录中 垃圾箱。”

sendKey
需要设置为 true,因为默认情况下 Aerospike 不存储密钥 - 它存储一个摘要,该摘要是密钥和集合名称上的 RIPEMD-160 哈希函数的结果。

您可以更改您在执行的操作中提供的

sendKey
上的
Policy

原始链接包含

Java
Golang
中的代码示例。

© www.soinside.com 2019 - 2024. All rights reserved.