# Can we override the way data gets stored in elasticsearch

**URL:** https://discuss.elastic.co/t/can-we-override-the-way-data-gets-stored-in-elasticsearch/257106
**Category:** Elasticsearch
**Created:** [November 30, 2020, 5:33pm UTC](https://discuss.elastic.co/t/can-we-override-the-way-data-gets-stored-in-elasticsearch/257106 "2020-11-30T17:33:27Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Vivek\_Sagar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_sagar/32/76044_2.png) [@Vivek\_Sagar](https://discuss.elastic.co/u/Vivek_Sagar)
#### Post date: [November 30, 2020, 5:33pm UTC](https://discuss.elastic.co/t/can-we-override-the-way-data-gets-stored-in-elasticsearch/257106/1 "2020-11-30T17:33:27Z")

</div>

Is there a way to override how the data is stored in elasticsearch? I want to encrypt the data just before elasticsearch writes it to file system and just before sending the search query to file-system send the encrypted value. Is there any extension point which can be overridden? Can I override any of the Lucene processor which does this?

Objective is to store encrypted data.

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [November 30, 2020, 5:48pm UTC](https://discuss.elastic.co/t/can-we-override-the-way-data-gets-stored-in-elasticsearch/257106/2 "2020-11-30T17:48:27Z")

</div>

Yes, no need to adjust anything in Elasticsearch or Lucene however, the recommended extension point for encrypting data on disk is the device mapper. In other words, use [`dm-crypt`](https://en.wikipedia.org/wiki/Dm-crypt).

---

<div class="post-metadata">

### Author: ![Vivek\_Sagar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_sagar/32/76044_2.png) [@Vivek\_Sagar](https://discuss.elastic.co/u/Vivek_Sagar)
#### Post date: [November 30, 2020, 6:03pm UTC](https://discuss.elastic.co/t/can-we-override-the-way-data-gets-stored-in-elasticsearch/257106/3 "2020-11-30T18:03:54Z")

</div>

Thanks David, but as you said, when using dm-crypt, data is encrypted on disk. Someone who is accessing the VM can still get the data. Is it possible to make sure the data is encrypted at OS level?

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [November 30, 2020, 6:16pm UTC](https://discuss.elastic.co/t/can-we-override-the-way-data-gets-stored-in-elasticsearch/257106/4 "2020-11-30T18:16:31Z")

</div>

> [@Vivek\_Sagar](#):
>
> Someone who is accessing the VM can still get the data.

If someone can access the VM they can extract the data (or the encryption keys) from Elasticsearch directly, no matter whether the encryption happens within Elasticsearch or within the device mapper.

---

<div class="post-metadata">

### Author: ![Vivek\_Sagar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_sagar/32/76044_2.png) [@Vivek\_Sagar](https://discuss.elastic.co/u/Vivek_Sagar)
#### Post date: [November 30, 2020, 7:27pm UTC](https://discuss.elastic.co/t/can-we-override-the-way-data-gets-stored-in-elasticsearch/257106/5 "2020-11-30T19:27:20Z")

</div>

I did not think that way. You are right David. 😃

---

<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: [December 28, 2020, 7:27pm UTC](https://discuss.elastic.co/t/can-we-override-the-way-data-gets-stored-in-elasticsearch/257106/6 "2020-12-28T19:27:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
