# Encrypted Index

**URL:** <https://discuss.elastic.co/t/encrypted-index/51023>\
**Category:** Elasticsearch\
**Created:** [May 26, 2016, 7:00am UTC](https://discuss.elastic.co/t/encrypted-index/51023 "2016-05-26T07:00:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![NiFiTweets](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@NiFiTweets](https://discuss.elastic.co/u/NiFiTweets)\
**Post date:** [May 26, 2016, 7:00am UTC](https://discuss.elastic.co/t/encrypted-index/51023/1 "2016-05-26T07:00:15Z")

</div>

I have a scenario where i have confidential data saved as employee records/financial records shouldn't be accessible to one another, unless they have the key to access it. Can this be achieved with ES?

1)I am looking for encrypted index having data which will fetch data only for the associated access key or else it will fetch junk values/bad request.  
2)And since I'm thinking of using ES as backend to another application, can this also be achieved with API calls?

Please Help! Thanks !!

---

<div class="post-metadata">

**Author:** ![thn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thn/32/8061_2.png) [@thn](https://discuss.elastic.co/u/thn)\
**Post date:** [May 26, 2016, 4:54pm UTC](https://discuss.elastic.co/t/encrypted-index/51023/2 "2016-05-26T16:54:12Z")

</div>

Here are a few things that you can think and decide what you want to do

1. If you are thinking about using ES as storage, the answer is no, use something else

2. I've seen other approach where the actual data or value to a field is encrypted first before it gets indexed by ES. If you take this approach, you have to think about how to search. I would not recommend to go with this either.

3. Since ES is a search engine, not a database or a filesystem, it will index data that you insert into to it. You can use the mapping to tell ES to index data but don't store, that means when you look into the index, you don't see "readable data" at all. When you do this, store the content somewhere else such as local file system, a database, something like Mongo GridFS, etc... that way you can encrypt the content before storing it. When your users search for info, the system can tell the users if there are hits or not with minimum info. When they select a search result to view, they have to provide a key either automatically based on their credentials or manually (it depends on how you want to build your system) then the system can use this key to decrypt the data for viewing.

4. Another option here is putting the restriction how you want users to view the data. I think ES has a product called Shield (it has a new name now in v5) that you can use.

If I were you, I would take a look at option 3 and 4, not 1 and 2.

---

<div class="post-metadata">

**Author:** ![tinle](https://avatars.discourse-cdn.com/v4/letter/t/c77e96/32.png) [@tinle](https://discuss.elastic.co/u/tinle)\
**Post date:** [May 26, 2016, 6:00pm UTC](https://discuss.elastic.co/t/encrypted-index/51023/3 "2016-05-26T18:00:29Z")

</div>

Take a look at Credeon (Hitachi). They had a booth at ElastiCon 2016 in SF.

[http://www.hitachi-solutions.com/securesearch/](http://www.hitachi-solutions.com/securesearch/)

From talking with the person at the booth, they support ES also.

---

<div class="post-metadata">

**Author:** ![Ramya](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@Ramya](https://discuss.elastic.co/u/Ramya)\
**Post date:** [January 30, 2017, 6:45am UTC](https://discuss.elastic.co/t/encrypted-index/51023/4 "2017-01-30T06:45:02Z")

</div>

Hi thn  
I am having the scenario to encrypt passwords (or other data) before saving it in ElasticsearchDB  
using nodejs is this possible? how can I acheive this ? please help me  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![thn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thn/32/8061_2.png) [@thn](https://discuss.elastic.co/u/thn)\
**Post date:** [January 30, 2017, 8:40pm UTC](https://discuss.elastic.co/t/encrypted-index/51023/5 "2017-01-30T20:40:41Z")

</div>

I don't use nodejs but with a quick search, you can find the following links

for encryption: [https://www.npmjs.com/package/crypto-js](https://www.npmjs.com/package/crypto-js)

for elasticsearch: [https://www.npmjs.com/package/elasticsearch](https://www.npmjs.com/package/elasticsearch)

---

<div class="post-metadata">

**Author:** ![Ramya](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@Ramya](https://discuss.elastic.co/u/Ramya)\
**Post date:** [January 31, 2017, 4:54am UTC](https://discuss.elastic.co/t/encrypted-index/51023/6 "2017-01-31T04:54:30Z")

</div>

Thank you thn...Found it as useful to me...

---

<div class="post-metadata">

**Author:** ![Ramya](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@Ramya](https://discuss.elastic.co/u/Ramya)\
**Post date:** [February 9, 2017, 4:45am UTC](https://discuss.elastic.co/t/encrypted-index/51023/7 "2017-02-09T04:45:55Z")

</div>

Hi thn  
Do u have any idea of encrypting some user data like mailid,name,mobile number  
in elastisearch index Directly using sense plugin.

---

<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:03pm UTC](https://discuss.elastic.co/t/encrypted-index/51023/8 "2017-07-05T22:03:27Z")

</div>


