# How to mask the data in Elasticsearch?

**URL:** <https://discuss.elastic.co/t/how-to-mask-the-data-in-elasticsearch/49753>\
**Category:** Elasticsearch\
**Created:** [May 11, 2016, 10:53am UTC](https://discuss.elastic.co/t/how-to-mask-the-data-in-elasticsearch/49753 "2016-05-11T10:53:52Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanju1323](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sanju1323](https://discuss.elastic.co/u/sanju1323)\
**Post date:** [May 11, 2016, 10:53am UTC](https://discuss.elastic.co/t/how-to-mask-the-data-in-elasticsearch/49753/1 "2016-05-11T10:53:52Z")

</div>

Hi,

I have some data that can't be exposed. So, I want to mask the data which is existing in the Elasticsearch Index. Is there a way to mask the data in Elasticsearch. If yes, please guide me the right direction.

Thanks & Regards,  
Dharma Sanjay Reddy

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 11, 2016, 10:58am UTC](https://discuss.elastic.co/t/how-to-mask-the-data-in-elasticsearch/49753/2 "2016-05-11T10:58:57Z")

</div>

You can do that with [https://www.elastic.co/guide/en/shield/current/index.html](https://www.elastic.co/guide/en/shield/current/index.html)

---

<div class="post-metadata">

**Author:** ![sanju1323](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sanju1323](https://discuss.elastic.co/u/sanju1323)\
**Post date:** [May 11, 2016, 11:19am UTC](https://discuss.elastic.co/t/how-to-mask-the-data-in-elasticsearch/49753/3 "2016-05-11T11:19:07Z")

</div>

Thanks @warkolm

Can you please help me in doing this. I'm not able find any thing from the link

---

<div class="post-metadata">

**Author:** ![sanju1323](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sanju1323](https://discuss.elastic.co/u/sanju1323)\
**Post date:** [May 11, 2016, 11:33am UTC](https://discuss.elastic.co/t/how-to-mask-the-data-in-elasticsearch/49753/4 "2016-05-11T11:33:06Z")

</div>

@warkolm arkolm Please find the sample data below

 ![](https://us1.discourse-cdn.com/elastic/original/2X/a/ac6a03eae6feb7ef1850d222e2462e7fc819967b.png)

Here, I need to mask the name Rakesh in both the fields ("studentName" and "Summary"). Is this possible? Not able to find anything on this part.

---

<div class="post-metadata">

**Author:** ![MrLee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrlee/32/9429_2.png) [@MrLee](https://discuss.elastic.co/u/MrLee)\
**Post date:** [May 11, 2016, 12:04pm UTC](https://discuss.elastic.co/t/how-to-mask-the-data-in-elasticsearch/49753/5 "2016-05-11T12:04:32Z")

</div>

In my opinion, ES can not do this like you have raised. Why not excluding the fields that include sensitive information in your searching request.

---

<div class="post-metadata">

**Author:** ![sanju1323](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sanju1323](https://discuss.elastic.co/u/sanju1323)\
**Post date:** [May 11, 2016, 12:18pm UTC](https://discuss.elastic.co/t/how-to-mask-the-data-in-elasticsearch/49753/6 "2016-05-11T12:18:02Z")

</div>

HI @MrLee

I can exclude "studentName" but can't exclude "Summary" as all the information regarding that record is present in that field. Is there any possibility of writing any regex and mask the data?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 11, 2016, 12:55pm UTC](https://discuss.elastic.co/t/how-to-mask-the-data-in-elasticsearch/49753/7 "2016-05-11T12:55:24Z")

</div>

This may be? [https://www.elastic.co/guide/en/shield/current/setting-up-field-and-document-level-security.html](https://www.elastic.co/guide/en/shield/current/setting-up-field-and-document-level-security.html)

---

<div class="post-metadata">

**Author:** ![sanju1323](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sanju1323](https://discuss.elastic.co/u/sanju1323)\
**Post date:** [May 11, 2016, 2:38pm UTC](https://discuss.elastic.co/t/how-to-mask-the-data-in-elasticsearch/49753/8 "2016-05-11T14:38:21Z")

</div>

@dadoonet  
This may give me the field level access for certain users. I need access to all the fields but instead of that name "Rakesh" I just need to replace somthing like XXXX OR ----- OR Any other string. Please help

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 11, 2016, 9:30pm UTC](https://discuss.elastic.co/t/how-to-mask-the-data-in-elasticsearch/49753/9 "2016-05-11T21:30:50Z")

</div>

ES cannot do that.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:52pm UTC](https://discuss.elastic.co/t/how-to-mask-the-data-in-elasticsearch/49753/10 "2017-07-05T22:52:22Z")

</div>


