# How to hash sensitive fields in Elasticsearch and show hash vs original based on user permissions?

**URL:** https://discuss.elastic.co/t/how-to-hash-sensitive-fields-in-elasticsearch-and-show-hash-vs-original-based-on-user-permissions/384905
**Category:** Elasticsearch
**Tags:** ingest-pipeline
**Created:** [February 4, 2026, 4:50am UTC](https://discuss.elastic.co/t/how-to-hash-sensitive-fields-in-elasticsearch-and-show-hash-vs-original-based-on-user-permissions/384905 "2026-02-04T04:50:10Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Abhi\_Abhishek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhi_abhishek/32/101426_2.png) [@Abhi\_Abhishek](https://discuss.elastic.co/u/Abhi_Abhishek)
#### Post date: [February 4, 2026, 4:50am UTC](https://discuss.elastic.co/t/how-to-hash-sensitive-fields-in-elasticsearch-and-show-hash-vs-original-based-on-user-permissions/384905/1 "2026-02-04T04:50:10Z")

</div>

We have some fields containing sensitive information, and we do not want all users to see the original values.  
We want to store these fields in a hashed form while indexing and control what different users can see.  
I have a few questions:

Does Elasticsearch support hashing a field during indexing?  
What are the recommended ways to implement hashing of field content at index time?  
How does querying behave on hashed fields?  
If a field is hashed, can we still search on it?  
Can hashed content be decoded back to its original value?

Permission‑based visibility requirement:

User1 (no permission) → Should see only the hashed value  
User2 (has permission) → Should see the original clear-text value

Is this possible in Elasticsearch using field‑level security or any other feature?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [February 4, 2026, 12:27pm UTC](https://discuss.elastic.co/t/how-to-hash-sensitive-fields-in-elasticsearch-and-show-hash-vs-original-based-on-user-permissions/384905/2 "2026-02-04T12:27:11Z")

</div>

> [@Abhi\_Abhishek](#):
>
> Does Elasticsearch support hashing a field during indexing?  
> What are the recommended ways to implement hashing of field content at index time?

Yes, you can use the `fingerprint` processor on an Ingest Pipeline or in Logstash.

> [@Abhi\_Abhishek](#):
>
> How does querying behave on hashed fields?  
> If a field is hashed, can we still search on it?

It works as any other field, but you can only search by the hashed value, you cannot search by the value of the field before generating the hash.

> [@Abhi\_Abhishek](#):
>
> Can hashed content be decoded back to its original value?

No, once you generate a hash for a f ield and index it, the original value is lost, if you want the original value you need to index it on a different field.

> [@Abhi\_Abhishek](#):
>
> Permission‑based visibility requirement:
> 
> User1 (no permission) → Should see only the hashed value  
> User2 (has permission) → Should see the original clear-text value
> 
> Is this possible in Elasticsearch using field‑level security or any other feature?

Yes, if you have a license you can use the field-level security, but again, if you want to search on the original value you need to index it on a field.

---

<div class="post-metadata">

### Author: ![Abhi\_Abhishek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhi_abhishek/32/101426_2.png) [@Abhi\_Abhishek](https://discuss.elastic.co/u/Abhi_Abhishek)
#### Post date: [February 4, 2026, 1:09pm UTC](https://discuss.elastic.co/t/how-to-hash-sensitive-fields-in-elasticsearch-and-show-hash-vs-original-based-on-user-permissions/384905/3 "2026-02-04T13:09:04Z")

</div>

Thank you!
