# Create UDF on record keys

**URL:** <https://discuss.aerospike.com/t/create-udf-on-record-keys/4598>\
**Category:** User Defined Functions (UDF)\
**Tags:** query, udf, index\
**Created:** [September 18, 2017, 10:38am UTC](https://discuss.aerospike.com/t/create-udf-on-record-keys/4598 "2017-09-18T10:38:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![waynenguyen](https://avatars.discourse-cdn.com/v4/letter/w/ed8c4c/32.png) [@waynenguyen](https://discuss.aerospike.com/u/waynenguyen)\
**Post date:** [September 18, 2017, 10:38am UTC](https://discuss.aerospike.com/t/create-udf-on-record-keys/4598/1 "2017-09-18T10:38:15Z")

</div>

Hi,

I have a set with the following data model:

- Key: a single string represents a domain
- Value: a list of string user ids associated with the domain

For example,

> .com.us | 11,22,33

> .us | 44, 55

> [google.com.us](http://google.com.us) | 66,77

From the client side, for each domain, I’d like to get the associated user ids. The caveat is when subdomain rules are applied. For example, here are the list of inputs and expected results

> ```
> fb.us | 44,55
> 
> ```

> [fb.com.us](http://fb.com.us) | 11,22,33

> [fb.google.com.us](http://fb.google.com.us) | 66,77

One way to go about this is splitting the domain into subdomains and do a multiget for all the domains. Can UDF be used in this case? I’m not quite experienced with UDF yet, but checking the documentation it seems like we can only write UDF for secondary indexes?

Thanks
