# Script bug or just me?

**URL:** <https://discuss.elastic.co/t/script-bug-or-just-me/47382>\
**Category:** Elasticsearch\
**Created:** [April 14, 2016, 12:25pm UTC](https://discuss.elastic.co/t/script-bug-or-just-me/47382 "2016-04-14T12:25:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrIncredible](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MrIncredible](https://discuss.elastic.co/u/MrIncredible)\
**Post date:** [April 14, 2016, 12:25pm UTC](https://discuss.elastic.co/t/script-bug-or-just-me/47382/1 "2016-04-14T12:25:09Z")

</div>

Hi everyone.

I'll keep it simple: Scripts in Groovy doesn't work when making iterations on arrays.

The mapping:

```auto
{
  "Xxx" : {
    "mappings" : {
      "node" : {
        "properties" : {
          "id" : {
            "type" : "double"
          },
          "searchTags" : {
            "type" : "nested",
            "properties" : {
              "id" : {
                "type" : "double"
              },
              "packages" : {
                "type" : "double"
              }
            }
          }
        }
      }
    }
  }
}

```

The following scripts are part of a bigger query, I've removed the rest so we can focus on this simple script that fails.  
This doesn't work:

```auto
return doc['searchTags.packages'].every { it == 1.0 }

```

but this works:

```auto
return doc['searchTags.packages'].count() > 0

```

All scripts that contains an iteration seems to fail. I'm using Elastic Search 2.2.0.0

I've attached a snippet of the stacktrace. ![](https://us1.discourse-cdn.com/elastic/original/2X/1/188c19827faa017566c82ce4ab0d6a6d2d602be5.png)

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 14, 2016, 12:57pm UTC](https://discuss.elastic.co/t/script-bug-or-just-me/47382/2 "2016-04-14T12:57:04Z")

</div>

Hey,

can you try a more recent version of Elasticsearch? You might have hit one of those

> <https://github.com/elastic/elasticsearch/issues/16194>

  

> <https://github.com/elastic/elasticsearch/issues/16536>

--Alex

---

<div class="post-metadata">

**Author:** ![MrIncredible](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MrIncredible](https://discuss.elastic.co/u/MrIncredible)\
**Post date:** [April 14, 2016, 1:00pm UTC](https://discuss.elastic.co/t/script-bug-or-just-me/47382/3 "2016-04-14T13:00:05Z")

</div>

Hi spinscale,

I think you might be right. I'll try updating and see if it solves my problem.  
I'll return with the result in a few hours :).

M.

---

<div class="post-metadata">

**Author:** ![MrIncredible](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MrIncredible](https://discuss.elastic.co/u/MrIncredible)\
**Post date:** [April 14, 2016, 1:12pm UTC](https://discuss.elastic.co/t/script-bug-or-just-me/47382/4 "2016-04-14T13:12:04Z")

</div>

It worked flawlessly! Upgraded to 2.3.1.0

Thanks for the help.

---

<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, 10:59pm UTC](https://discuss.elastic.co/t/script-bug-or-just-me/47382/5 "2017-07-05T22:59:18Z")

</div>


