# Migrate ElasticSearch 2.x groovy scripts straight to 6.x

**URL:** https://discuss.elastic.co/t/migrate-elasticsearch-2-x-groovy-scripts-straight-to-6-x/149400
**Category:** Elasticsearch
**Created:** [September 21, 2018, 6:50am UTC](https://discuss.elastic.co/t/migrate-elasticsearch-2-x-groovy-scripts-straight-to-6-x/149400 "2018-09-21T06:50:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![gskema](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gskema/32/13648_2.png) [@gskema](https://discuss.elastic.co/u/gskema)
#### Post date: [September 21, 2018, 6:50am UTC](https://discuss.elastic.co/t/migrate-elasticsearch-2-x-groovy-scripts-straight-to-6-x/149400/1 "2018-09-21T06:50:08Z")

</div>

We want to migrate straight from 2.x to 6.x. We cleaned up most of the deprecated queries based on (2.x -\> 5.x) migration plugin. We don't use search features that removed in 5.x -\> 6.x. The only thing remaining is our groovy scripts.

2.x doesn't have painless, 5.x introduced it and 6.x removed groovy. There is no intermediary script lang that we could use.

Is there a way to migrate scripts from 2.x -\> 5.x?

---

<div class="post-metadata">

### Author: ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)
#### Post date: [September 27, 2018, 5:00am UTC](https://discuss.elastic.co/t/migrate-elasticsearch-2-x-groovy-scripts-straight-to-6-x/149400/2 "2018-09-27T05:00:17Z")

</div>

Most groovy scripts should just work in painless, as both are based on java, and added features over java of painless were based on groovy. I recommend running a 1 node cluster and copying over your groovy scripts, tweaking them until they compile, and then running them with some sample data to ensure they still produce the same expected results.

---

<div class="post-metadata">

### Author: ![gskema](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gskema/32/13648_2.png) [@gskema](https://discuss.elastic.co/u/gskema)
#### Post date: [September 28, 2018, 1:55pm UTC](https://discuss.elastic.co/t/migrate-elasticsearch-2-x-groovy-scripts-straight-to-6-x/149400/3 "2018-09-28T13:55:30Z")

</div>

Thank you for the response.

Our plan is to create a new cluster and gradually move all features one by one by switching connections. We'll do some scripts testing in the cluster with sample data (same as you suggested), then replace all the scripts at the same time when we switch the connections.

---

<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: [October 26, 2018, 1:55pm UTC](https://discuss.elastic.co/t/migrate-elasticsearch-2-x-groovy-scripts-straight-to-6-x/149400/4 "2018-10-26T13:55:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
