before i go further, your search is very heavy as it calculates all data and hashes user, if you want to mask the user field, you can do it at index time with props.conf and tranforms.conf also, check out the new feature in Splunk 8.0 around work with data before its indexed
i think the closest to what you are after is: "search filters" however, although they have some downsides,
read here:
https://docs.splunk.com/Documentation/Splunk/8.0.0/Security/Addandeditroles#Specify_search_restrictions_for_a_role
there is another doc that i cant find at the moment.
regardless, i think that what @kamlesh_vaghela suggested (macros) is a better solution, as you will can also put variables in them and they are knowledge objects and not roles configuration.
hope it helps
... View more