Mapping for a field which will not be searched at all

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!

I'd use the binary data type instead.

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!!

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

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

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