title: ElasticSearch 5.2 Unknown key for a START_OBJECT in [script]. request
body: <p>Hello I am trying to remove record by searching in nested data of array via script.
  Is possible to remove data with using script for _delete_by_query ?
  Version of elasticsearch 5.2</p>
  <p>My request looks like</p>
  <pre><code>POST /test_index/_delete_by_query
  {
    &quot;query&quot;: {
      &quot;bool&quot;: {
        &quot;must&quot;: [
          {
            &quot;exists&quot;: {
              &quot;field&quot;:&quot;userPermission&quot;
            }
          }
        ]
      }
    },
    &quot;script&quot;:{
      &quot;inline&quot;:&quot;&quot;&quot;
      for (int i = 0; i &lt; ctx._source.userPermission.size(); i++) {
          if(ctx._source.userPermission[i].id == '760100000-100000')
          {
            return true
          }
      }
      return false
      &quot;&quot;&quot;
    }
  }
  </code></pre>
  <p>I get an error:</p>
  <p>{
  &quot;error&quot;: {
  &quot;type&quot;: &quot;parsing_exception&quot;,
  &quot;reason&quot;: &quot;Unknown key for a START_OBJECT in [script].&quot;,
  &quot;line&quot;: 1,
  &quot;col&quot;: 77
  },
  &quot;status&quot;: 400
  }</p>
  <p>It is example of data:</p>
  <pre><code>{
      &quot;_index&quot;: &quot;test_index&quot;,
      &quot;_type&quot;: &quot;doc&quot;,
      &quot;_id&quot;: &quot;AXXDZFKKgDFBfUY9kVS6&quot;,
      &quot;_score&quot;: 1,
      &quot;_source&quot;: {
        &quot;test_field&quot;: &quot;Test&quot;,
        &quot;userPermission&quot;: [
          {
            &quot;fullName&quot;: &quot;Test 55&quot;,
            &quot;id&quot;: '760100000-100000'
          },
          {
            &quot;fullName&quot;: &quot;Test33&quot;,
            &quot;id&quot;: 555
          },
          {
            &quot;fullName&quot;: &quot;Test 1&quot;,
            &quot;id&quot;: 444
          }
        ]
      }
    }
  </code></pre>