Hiera's data lookups are all done with reference to the details of the node being configured, and it's that node's scope which informs Hiera the datasets it should select, how to order the data, and how to interpolate certain values.
See the Hiera documentation for more specifics on debugging and the lookup function: https://puppet.com/docs/puppet/5.3/hiera_quick.html#testing-hiera-data-on-the-command-line and https://puppet.com/docs/puppet/5.3/man/lookup.html.