String as Hash


We have many string values, which we are indexing as not_analyzed. Our main aim is only to aggregate these values.

For using these strings in our REST API, we would prefer to have it as a MD5Hash (in the field urlHash), so that it looks cleaner. The issue is, for this to work, I have to save the original string as it is, and also the urlHash too.

And when I aggregate, I have to aggregate based on the string and use "Top Hit Aggregate" to fetch the urlHash too in the aggregate result.

Is there a better approach than this?