title: Elasticsearch Scripting: updating every array element
body: <p>es version 5.4.1</p>
  
  <p>I have a document like that </p>
  
  <pre><code>{'_id': 'AWUe4rSpgJ6eZRtHLwRC',
  '_index': 'test',
  '_score': 1,
  '_source': {'data': [1, 2, 3, 4]},
  '_type': 'test'}
  </code></pre>
  
  <p>and I am trying to add a number to all elements in data.</p>
  
  <p>what I try is :</p>
  
  <pre><code>{  
      'query':{  
          'match_all':{}
      },
      'script':{  
          'inline': "for (int i=0;i&lt;ctx._source.data.size();i++) {ctx._source.data[i]=ctx._source.data[i] + 1000000};",
          'lang':'painless'
      }
  }
  </code></pre>
  
  <p>but I got </p>
  
  <pre><code>{'reason': "unexpected token [';'] was expecting one of [&lt;EOF&gt;]."}
  </code></pre>
  
  <p>I am new to painless. How can I make it current?</p>