# Does doc\['field\_name'\].values preserve order

**URL:** https://discuss.elastic.co/t/does-doc-field-name-values-preserve-order/22012
**Category:** Elasticsearch
**Created:** [February 6, 2015, 12:41pm UTC](https://discuss.elastic.co/t/does-doc-field-name-values-preserve-order/22012 "2015-02-06T12:41:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)
#### Post date: [February 6, 2015, 12:41pm UTC](https://discuss.elastic.co/t/does-doc-field-name-values-preserve-order/22012/1 "2015-02-06T12:41:13Z")

</div>

Hi ,

In scripting shown here  
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#\_document\_fields](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_document_fields)  
,  
does the values function returns the troken in the order in which it was  
indexed.

For eg: if the field value is as follows

"arrayData" : ["one" , "two" , "three"]

Will doc['arrayData'].values give results in the order in which it was  
index , that is as ["one , "two" , "three"] ?

Thanks  
Vineeth Mohan,  
Elasticsearch consultant,  
qbox.io ( Elasticsearch service provider [http://qbox.io](http://qbox.io))

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3Dow1t24Wfd-P%3DZHo%3DNB6kCyJsNTvYC%3DndJ-uwCuXWpRw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3Dow1t24Wfd-P%3DZHo%3DNB6kCyJsNTvYC%3DndJ-uwCuXWpRw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:34am UTC](https://discuss.elastic.co/t/does-doc-field-name-values-preserve-order/22012/2 "2017-07-06T00:34:31Z")

</div>


