# Mapping for a field which will not be searched at all

**URL:** https://discuss.elastic.co/t/mapping-for-a-field-which-will-not-be-searched-at-all/201389
**Category:** Elasticsearch
**Created:** [September 27, 2019, 11:49am UTC](https://discuss.elastic.co/t/mapping-for-a-field-which-will-not-be-searched-at-all/201389 "2019-09-27T11:49:24Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![nahiko2000](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@nahiko2000](https://discuss.elastic.co/u/nahiko2000)
#### Post date: [September 27, 2019, 11:49am UTC](https://discuss.elastic.co/t/mapping-for-a-field-which-will-not-be-searched-at-all/201389/1 "2019-09-27T11:49:24Z")

</div>

Hi!

I have some data (xml like formatted data) which before saving it to Elasticsearch, I am going to LZ4 compress and then convert to Base64, so it will be just a long non-spaced string.  
I want to set this data in an Elasticsearch field, the documents where this data will be, will have some other fields like timestamp, UUID, etc, in order to search for it, but I will never search using the Base64 field.  
Even the data is LZ4 compressed, it could sometimes be large, like 1 MB.

What mapping should I use?

```
"type" : "keyword",
"norms" : false,
"index" : false

```

Perhaps that one? or should I add some other properties? may be I should use "type" : "text" ?

Thank you!

---

<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: [September 27, 2019, 1:43pm UTC](https://discuss.elastic.co/t/mapping-for-a-field-which-will-not-be-searched-at-all/201389/2 "2019-09-27T13:43:53Z")

</div>

I'd use the `binary` data type instead.

---

<div class="post-metadata">

### Author: ![nahiko2000](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@nahiko2000](https://discuss.elastic.co/u/nahiko2000)
#### Post date: [September 30, 2019, 6:51am UTC](https://discuss.elastic.co/t/mapping-for-a-field-which-will-not-be-searched-at-all/201389/3 "2019-09-30T06:51:00Z")

</div>

Hi dadoonet!

Thanks a lot, I did not about binary data type mapping, however now knowing it, I have to say there is another field in the document "encrypted", which is boolean.  
When encrypted is true, the xml like formatted field will be compressed, and converted to Base64 (actually, it will be compressed, encripted and then converted to Base64), but if the encrypted field is false, the xml like field will be just that, an xml like string field.

So, in that case, is it better a "keyword", or a "text" type?  
Anyhow I am not going to search into that field, so I do not want it to be indexed, nor scored, I guess I should set store to false. I just want it to take the least space and to be saved as fast as possible.

Thanks again!!

---

<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: [September 30, 2019, 1:58pm UTC](https://discuss.elastic.co/t/mapping-for-a-field-which-will-not-be-searched-at-all/201389/4 "2019-09-30T13:58:40Z")

</div>

I'd probably try `text` with `"index": false`.

---

<div class="post-metadata">

### Author: ![nahiko2000](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@nahiko2000](https://discuss.elastic.co/u/nahiko2000)
#### Post date: [October 1, 2019, 8:01am UTC](https://discuss.elastic.co/t/mapping-for-a-field-which-will-not-be-searched-at-all/201389/5 "2019-10-01T08:01:53Z")

</div>

Thank you very much dadoonet, I will go with text and "index" : false

---

<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: [October 29, 2019, 8:01am UTC](https://discuss.elastic.co/t/mapping-for-a-field-which-will-not-be-searched-at-all/201389/6 "2019-10-29T08:01:55Z")

</div>

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