title: elasticsearch doc['...'] Arrays and order
body: <p>i need to access document values stored in arrays from script. The order of the items in the array is important. </p>
  
  <p>using doc['...'] to retrieve the array will mix up the order :-( </p>
  
  <p>suppose a simple document like this</p>
  
  <pre><code>{
      "ar":[5,4,3,2,1]
  }
  </code></pre>
  
  <p>retrieved using this Query:</p>
  
  <pre><code>{
    "query":{
      "match_all":{}
    },
    "script_fields": {
      "values": {
        "script": {
          "inline":"return doc['ar']"
        }
      }
    }
  }
  </code></pre>
  
  <p>will return the array in reversed(sorted) order: [1,2,3,4,5]
  is there a way to prevent this behavior?</p>
  
  <p>i can not resort to using _source because i need this in a "has_child" query, which does not support _source.</p>
  
  <p>any ideas?</p>