# Storing a byte array

**URL:** <https://discuss.elastic.co/t/storing-a-byte-array/46300>\
**Category:** Elasticsearch\
**Created:** [April 4, 2016, 10:04pm UTC](https://discuss.elastic.co/t/storing-a-byte-array/46300 "2016-04-04T22:04:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rich\_Burdon](https://avatars.discourse-cdn.com/v4/letter/r/90ced4/32.png) [@Rich\_Burdon](https://discuss.elastic.co/u/Rich_Burdon)\
**Post date:** [April 4, 2016, 10:04pm UTC](https://discuss.elastic.co/t/storing-a-byte-array/46300/1 "2016-04-04T22:04:59Z")

</div>

I get an exception when trying to store (index) a document that has a field that contains a byte array:

Are such fields allowed?  
Is any special index configuration necessary? (other than "not\_analyzed"  
Any docs?

File "sub/data/tools/python/lib/python2.7/site-packages/elasticsearch/serializer.py", line 50, in dumps  
raise SerializationError(data, e)  
SerializationError: '...', 69, 70, 'ordinal not in range(128)'))

---

<div class="post-metadata">

**Author:** ![Rich\_Burdon](https://avatars.discourse-cdn.com/v4/letter/r/90ced4/32.png) [@Rich\_Burdon](https://discuss.elastic.co/u/Rich_Burdon)\
**Post date:** [April 4, 2016, 10:17pm UTC](https://discuss.elastic.co/t/storing-a-byte-array/46300/2 "2016-04-04T22:17:21Z")

</div>

Answer:  
type: "binary"  
And the value must be Base64 encoded (not an arbitrary byte array)

---

<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, 11:02pm UTC](https://discuss.elastic.co/t/storing-a-byte-array/46300/3 "2017-07-05T23:02:27Z")

</div>


