# Document Array Sorted

**URL:** <https://discuss.elastic.co/t/document-array-sorted/41788>\
**Category:** Elasticsearch\
**Created:** [February 15, 2016, 1:17pm UTC](https://discuss.elastic.co/t/document-array-sorted/41788 "2016-02-15T13:17:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Borut\_Svara](https://avatars.discourse-cdn.com/v4/letter/b/c5a1d2/32.png) [@Borut\_Svara](https://discuss.elastic.co/u/Borut_Svara)\
**Post date:** [February 15, 2016, 1:17pm UTC](https://discuss.elastic.co/t/document-array-sorted/41788/1 "2016-02-15T13:17:27Z")

</div>

Hi everyone,

I have the following issue i have a list of documents that should store a key/value map as a scoring script is using them to score results upon a key/value map passed as parameter.

As from what I found out, doc[] can only load arrays (the size of this map is small compared to the rest of the document so I'm trying to avoid \_source) i rearranged the key/value map in:

"key"=["1","4","7","8"]  
"val"=[0.7,0.4,0.6,0.2]

But I found out that one of those (or maybe both) when retrived with doc[].values all array elements are rearranged in ascending order that destroy the map structure.

I was browsing quite a long time about this issue, but i was unable to figure out how can I approach this problem to solve it in the best way.

Any advice?

---

<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:16pm UTC](https://discuss.elastic.co/t/document-array-sorted/41788/2 "2017-07-05T23:16:27Z")

</div>


