From 5932ca3b1bfed2ff555032610814fbd957610e54 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Fri, 28 Mar 2014 18:35:10 +0100 Subject: [PATCH 01/31] Create branches according to elasticsearch versions We create branches: * es-0.90 for elasticsearch 0.90 * es-1.0 for elasticsearch 1.0 * es-1.1 for elasticsearch 1.1 * master for elasticsearch master We also check that before releasing we don't have a dependency to an elasticsearch SNAPSHOT version. Add links to each version in documentation (cherry picked from commit 22465d2) --- README.md | 11 +++++-- dev-tools/build_release.py | 29 +++++++++++++++++++ pom.xml | 2 +- .../JavaScriptScriptSearchTests.java | 3 -- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a5120e6..8d12b6f 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,21 @@ The JavaScript language plugin allows to have `javascript` (or `js`) as the lang In order to install the plugin, simply run: `bin/plugin -install elasticsearch/elasticsearch-lang-javascript/2.0.0.RC1`. -* For 1.0.x elasticsearch versions, look at [master branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/master). -* For 0.90.x elasticsearch versions, look at [1.x branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/1.x). +* For master elasticsearch versions, look at [master branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/master). +* For 1.1.x elasticsearch versions, look at [es-1.1 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.1). +* For 1.0.x elasticsearch versions, look at [es-1.0 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.0). +* For 0.90.x elasticsearch versions, look at [es-0.90 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-0.90). | JavaScript Lang Plugin | elasticsearch | rhino | Release date | |-----------------------------|---------------------|----------|:------------:| | 2.0.0-SNAPSHOT | 1.0.0.RC1 -> master | 1.7R4 | XXXX-XX-XX | | 2.0.0.RC1 | 1.0.0.RC1 -> master | 1.7R4 | 2014-01-15 | +Please read documentation relative to the version you are using: + +* [2.0.0-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/es-1.0/README.md) +* [2.0.0.RC1](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/v2.0.0.RC1/README.md) + Using javascript with function_score ------------------------------------ diff --git a/dev-tools/build_release.py b/dev-tools/build_release.py index 74acd8c..db83454 100755 --- a/dev-tools/build_release.py +++ b/dev-tools/build_release.py @@ -208,6 +208,29 @@ def callback(line): return line process_file(readme_file, callback) +# Moves the README.md file from a snapshot to a release (documentation link) +def remove_documentation_snapshot(readme_file, repo_url, release, branch): + pattern = '* [%s-SNAPSHOT](%sblob/%s/README.md)' % (release, repo_url, branch) + replacement = '* [%s](%sblob/v%s/README.md)' % (release, repo_url, release) + def callback(line): + # If we find pattern, we replace its content + if line.find(pattern) >= 0: + return line.replace(pattern, replacement) + else: + return line + process_file(readme_file, callback) + +# Add in README.markdown file the documentation for the next version +def add_documentation_snapshot(readme_file, repo_url, release, snapshot, branch): + pattern = '* [%s](%sblob/v%s/README.md)' % (release, repo_url, release) + replacement = '* [%s-SNAPSHOT](%sblob/%s/README.md)' % (snapshot, repo_url, branch) + def callback(line): + # If we find pattern, we copy the line and replace its content + if line.find(pattern) >= 0: + return line.replace(pattern, replacement)+line + else: + return line + process_file(readme_file, callback) # Set release date in README.md file def set_date(readme_file): @@ -603,8 +626,12 @@ def check_email_settings(): artifact_name = find_from_pom('name') artifact_description = find_from_pom('description') project_url = find_from_pom('url') + elasticsearch_version = find_from_pom('elasticsearch.version') print(' Artifact Id: [%s]' % artifact_id) print(' Release version: [%s]' % release_version) + print(' Elasticsearch: [%s]' % elasticsearch_version) + if elasticsearch_version.find('-SNAPSHOT') != -1: + raise RuntimeError('Can not release with a SNAPSHOT elasticsearch dependency: %s' % elasticsearch_version) # extract snapshot default_snapshot_version = guess_snapshot(release_version) @@ -626,6 +653,7 @@ def check_email_settings(): try: pending_files = [POM_FILE, README_FILE] remove_maven_snapshot(POM_FILE, release_version) + remove_documentation_snapshot(README_FILE, project_url, release_version, src_branch) remove_version_snapshot(README_FILE, release_version) set_date(README_FILE) set_install_instructions(README_FILE, artifact_id, release_version) @@ -657,6 +685,7 @@ def check_email_settings(): add_maven_snapshot(POM_FILE, release_version, snapshot_version) add_version_snapshot(README_FILE, release_version, snapshot_version) + add_documentation_snapshot(README_FILE, project_url, release_version, snapshot_version, src_branch) add_pending_files(*pending_files) commit_snapshot() diff --git a/pom.xml b/pom.xml index 0491010..b1056cf 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ 1.0.1 - 4.7.0 + 4.6.1 1 true onerror diff --git a/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java b/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java index f8918d4..d8eebd7 100644 --- a/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java +++ b/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java @@ -44,7 +44,6 @@ public class JavaScriptScriptSearchTests extends ElasticsearchIntegrationTest { @Test public void testJavaScriptFilter() throws Exception { - wipeIndices("test"); createIndex("test"); index("test", "type1", "1", jsonBuilder().startObject().field("test", "value beck").field("num1", 1.0f).endObject()); flush(); @@ -95,7 +94,6 @@ public void testJavaScriptFilter() throws Exception { @Test public void testScriptFieldUsingSource() throws Exception { - wipeIndices("test"); createIndex("test"); index("test", "type1", "1", jsonBuilder().startObject() @@ -130,7 +128,6 @@ public void testScriptFieldUsingSource() throws Exception { @Test public void testCustomScriptBoost() throws Exception { - wipeIndices("test"); createIndex("test"); index("test", "type1", "1", jsonBuilder().startObject().field("test", "value beck").field("num1", 1.0f).endObject()); index("test", "type1", "2", jsonBuilder().startObject().field("test", "value beck").field("num1", 2.0f).endObject()); From 6d6aa6e8122e08641e85a65a11ed28ea4fb73eb3 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Fri, 28 Mar 2014 18:35:10 +0100 Subject: [PATCH 02/31] Update to elasticsearch 1.1.0 Closes #18. --- README.md | 6 ++---- pom.xml | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8d12b6f..3cb3dcc 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,11 @@ In order to install the plugin, simply run: `bin/plugin -install elasticsearch/e | JavaScript Lang Plugin | elasticsearch | rhino | Release date | |-----------------------------|---------------------|----------|:------------:| -| 2.0.0-SNAPSHOT | 1.0.0.RC1 -> master | 1.7R4 | XXXX-XX-XX | -| 2.0.0.RC1 | 1.0.0.RC1 -> master | 1.7R4 | 2014-01-15 | +| 2.1.0-SNAPSHOT | 1.1.0 -> 1.1 | 1.7R4 | XXXX-XX-XX | Please read documentation relative to the version you are using: -* [2.0.0-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/es-1.0/README.md) -* [2.0.0.RC1](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/v2.0.0.RC1/README.md) +* [2.1.0-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/es-1.1/README.md) Using javascript with function_score ------------------------------------ diff --git a/pom.xml b/pom.xml index b1056cf..d9b7335 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.elasticsearch elasticsearch-lang-javascript - 2.0.0-SNAPSHOT + 2.1.0-SNAPSHOT jar Elasticsearch JavaScript language plugin The JavaScript language plugin allows to have javascript as the language of scripts to execute. @@ -32,8 +32,8 @@ - 1.0.1 - 4.6.1 + 1.1.0 + 4.7.0 1 true onerror From 7cc97efd30a14e4f16a3764df5efdf933fb6e07f Mon Sep 17 00:00:00 2001 From: David Pilato Date: Fri, 28 Mar 2014 19:19:23 +0100 Subject: [PATCH 03/31] prepare release elasticsearch-lang-javascript-2.1.0 --- README.md | 6 +++--- pom.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3cb3dcc..79908f6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ JavaScript lang Plugin for Elasticsearch The JavaScript language plugin allows to have `javascript` (or `js`) as the language of scripts to execute. -In order to install the plugin, simply run: `bin/plugin -install elasticsearch/elasticsearch-lang-javascript/2.0.0.RC1`. +In order to install the plugin, simply run: `bin/plugin -install elasticsearch/elasticsearch-lang-javascript/2.1.0`. * For master elasticsearch versions, look at [master branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/master). * For 1.1.x elasticsearch versions, look at [es-1.1 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.1). @@ -12,11 +12,11 @@ In order to install the plugin, simply run: `bin/plugin -install elasticsearch/e | JavaScript Lang Plugin | elasticsearch | rhino | Release date | |-----------------------------|---------------------|----------|:------------:| -| 2.1.0-SNAPSHOT | 1.1.0 -> 1.1 | 1.7R4 | XXXX-XX-XX | +| 2.1.0 | 1.1.0 -> 1.1 | 1.7R4 | 2014-03-28 | Please read documentation relative to the version you are using: -* [2.1.0-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/es-1.1/README.md) +* [2.1.0](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/v2.1.0/README.md) Using javascript with function_score ------------------------------------ diff --git a/pom.xml b/pom.xml index d9b7335..89787a2 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.elasticsearch elasticsearch-lang-javascript - 2.1.0-SNAPSHOT + 2.1.0 jar Elasticsearch JavaScript language plugin The JavaScript language plugin allows to have javascript as the language of scripts to execute. From e81654a49671c1d428c39109ea973bf95521299a Mon Sep 17 00:00:00 2001 From: David Pilato Date: Fri, 28 Mar 2014 19:20:54 +0100 Subject: [PATCH 04/31] prepare for next development iteration --- README.md | 2 ++ pom.xml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 79908f6..e50120a 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,12 @@ In order to install the plugin, simply run: `bin/plugin -install elasticsearch/e | JavaScript Lang Plugin | elasticsearch | rhino | Release date | |-----------------------------|---------------------|----------|:------------:| +| 2.1.1-SNAPSHOT | 1.1.0 -> 1.1 | 1.7R4 | XXXX-XX-XX | | 2.1.0 | 1.1.0 -> 1.1 | 1.7R4 | 2014-03-28 | Please read documentation relative to the version you are using: +* [2.1.1-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/es-1.1/README.md) * [2.1.0](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/v2.1.0/README.md) Using javascript with function_score diff --git a/pom.xml b/pom.xml index 89787a2..4f525c3 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.elasticsearch elasticsearch-lang-javascript - 2.1.0 + 2.1.1-SNAPSHOT jar Elasticsearch JavaScript language plugin The JavaScript language plugin allows to have javascript as the language of scripts to execute. From 7b4e3fbb95f6b869a4873c3590f6c79f76d09df2 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Fri, 23 May 2014 19:44:38 +0200 Subject: [PATCH 05/31] Update to elasticsearch 1.2.0 Closes #20 Fix #19 --- README.md | 7 +++---- pom.xml | 10 +++++----- .../javascript/JavaScriptScriptEngineService.java | 5 +++++ .../javascript/JavaScriptScriptMultiThreadedTest.java | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e50120a..88d7afe 100644 --- a/README.md +++ b/README.md @@ -6,19 +6,18 @@ The JavaScript language plugin allows to have `javascript` (or `js`) as the lang In order to install the plugin, simply run: `bin/plugin -install elasticsearch/elasticsearch-lang-javascript/2.1.0`. * For master elasticsearch versions, look at [master branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/master). +* For 1.2.x elasticsearch versions, look at [es-1.2 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.2). * For 1.1.x elasticsearch versions, look at [es-1.1 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.1). * For 1.0.x elasticsearch versions, look at [es-1.0 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.0). * For 0.90.x elasticsearch versions, look at [es-0.90 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-0.90). | JavaScript Lang Plugin | elasticsearch | rhino | Release date | |-----------------------------|---------------------|----------|:------------:| -| 2.1.1-SNAPSHOT | 1.1.0 -> 1.1 | 1.7R4 | XXXX-XX-XX | -| 2.1.0 | 1.1.0 -> 1.1 | 1.7R4 | 2014-03-28 | +| 2.2.0-SNAPSHOT | 1.2.0 -> 1.2 | 1.7R4 | XXXX-XX-XX | Please read documentation relative to the version you are using: -* [2.1.1-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/es-1.1/README.md) -* [2.1.0](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/v2.1.0/README.md) +* [2.2.0-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/es-1.2/README.md) Using javascript with function_score ------------------------------------ diff --git a/pom.xml b/pom.xml index 4f525c3..03aadbb 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.elasticsearch elasticsearch-lang-javascript - 2.1.1-SNAPSHOT + 2.2.0-SNAPSHOT jar Elasticsearch JavaScript language plugin The JavaScript language plugin allows to have javascript as the language of scripts to execute. @@ -32,8 +32,8 @@ - 1.1.0 - 4.7.0 + 1.2.0 + 4.8.1 1 true onerror @@ -117,8 +117,8 @@ maven-compiler-plugin 2.3.2 - 1.6 - 1.6 + 1.7 + 1.7 diff --git a/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java b/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java index eacc8f5..7b564e0 100644 --- a/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java +++ b/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java @@ -81,6 +81,11 @@ public String[] extensions() { return new String[]{"js"}; } + @Override + public boolean sandboxed() { + return false; + } + @Override public Object compile(String script) { Context ctx = Context.enter(); diff --git a/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptMultiThreadedTest.java b/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptMultiThreadedTest.java index 26eab20..381de8e 100644 --- a/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptMultiThreadedTest.java +++ b/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptMultiThreadedTest.java @@ -20,7 +20,6 @@ package org.elasticsearch.script.javascript; import org.elasticsearch.common.settings.ImmutableSettings; -import org.elasticsearch.common.util.concurrent.jsr166y.ThreadLocalRandom; import org.elasticsearch.script.ExecutableScript; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; @@ -29,6 +28,7 @@ import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicBoolean; import static org.hamcrest.Matchers.equalTo; From 3a20ae3963749a7efbac1033516c45a48aef295d Mon Sep 17 00:00:00 2001 From: David Pilato Date: Fri, 23 May 2014 19:51:15 +0200 Subject: [PATCH 06/31] Update to elasticsearch 1.3.0 Closes #21 --- README.md | 5 +++-- pom.xml | 4 ++-- .../javascript/JavaScriptScriptSearchTests.java | 12 ++++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 88d7afe..ddb2627 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ The JavaScript language plugin allows to have `javascript` (or `js`) as the lang In order to install the plugin, simply run: `bin/plugin -install elasticsearch/elasticsearch-lang-javascript/2.1.0`. * For master elasticsearch versions, look at [master branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/master). +* For 1.3.x elasticsearch versions, look at [es-1.3 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.3). * For 1.2.x elasticsearch versions, look at [es-1.2 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.2). * For 1.1.x elasticsearch versions, look at [es-1.1 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.1). * For 1.0.x elasticsearch versions, look at [es-1.0 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.0). @@ -13,11 +14,11 @@ In order to install the plugin, simply run: `bin/plugin -install elasticsearch/e | JavaScript Lang Plugin | elasticsearch | rhino | Release date | |-----------------------------|---------------------|----------|:------------:| -| 2.2.0-SNAPSHOT | 1.2.0 -> 1.2 | 1.7R4 | XXXX-XX-XX | +| 2.3.0-SNAPSHOT | 1.3.0 -> 1.3 | 1.7R4 | XXXX-XX-XX | Please read documentation relative to the version you are using: -* [2.2.0-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/es-1.2/README.md) +* [2.3.0-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/es-1.3/README.md) Using javascript with function_score ------------------------------------ diff --git a/pom.xml b/pom.xml index 03aadbb..0b00cbe 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.elasticsearch elasticsearch-lang-javascript - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT jar Elasticsearch JavaScript language plugin The JavaScript language plugin allows to have javascript as the language of scripts to execute. @@ -32,7 +32,7 @@ - 1.2.0 + 1.3.0-SNAPSHOT 4.8.1 1 true diff --git a/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java b/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java index d8eebd7..1a04f5e 100644 --- a/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java +++ b/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java @@ -21,7 +21,10 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; +import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders; +import org.elasticsearch.plugins.PluginsService; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; @@ -40,8 +43,17 @@ /** * */ +@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE) public class JavaScriptScriptSearchTests extends ElasticsearchIntegrationTest { + @Override + protected Settings nodeSettings(int nodeOrdinal) { + return ImmutableSettings.builder() + .put(super.nodeSettings(nodeOrdinal)) + .put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true) + .build(); + } + @Test public void testJavaScriptFilter() throws Exception { createIndex("test"); From c3964ad4d3680537f8d5699c792e608f5776daa0 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Thu, 24 Jul 2014 00:12:53 +0200 Subject: [PATCH 07/31] Update to Lucene 4.9.0 / elasticsearch 1.3.0 Related to #21. Closes #22. --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0b00cbe..8a6c9a5 100644 --- a/pom.xml +++ b/pom.xml @@ -32,8 +32,8 @@ - 1.3.0-SNAPSHOT - 4.8.1 + 1.3.0 + 4.9.0 1 true onerror From e03a16bf28ff06bb34e68c55a79f6f9326aa5575 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Thu, 24 Jul 2014 00:44:04 +0200 Subject: [PATCH 08/31] Update to elasticsearch 1.4.0 Closes #24. --- README.md | 5 +++-- pom.xml | 4 ++-- .../script/javascript/JavaScriptScriptEngineService.java | 5 ----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ddb2627..a3c883c 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ The JavaScript language plugin allows to have `javascript` (or `js`) as the lang In order to install the plugin, simply run: `bin/plugin -install elasticsearch/elasticsearch-lang-javascript/2.1.0`. * For master elasticsearch versions, look at [master branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/master). +* For 1.4.x elasticsearch versions, look at [es-1.4 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.4). * For 1.3.x elasticsearch versions, look at [es-1.3 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.3). * For 1.2.x elasticsearch versions, look at [es-1.2 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.2). * For 1.1.x elasticsearch versions, look at [es-1.1 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.1). @@ -14,11 +15,11 @@ In order to install the plugin, simply run: `bin/plugin -install elasticsearch/e | JavaScript Lang Plugin | elasticsearch | rhino | Release date | |-----------------------------|---------------------|----------|:------------:| -| 2.3.0-SNAPSHOT | 1.3.0 -> 1.3 | 1.7R4 | XXXX-XX-XX | +| 2.4.0-SNAPSHOT | 1.4.0 -> 1.4 | 1.7R4 | XXXX-XX-XX | Please read documentation relative to the version you are using: -* [2.3.0-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/es-1.3/README.md) +* [2.4.0-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/es-1.4/README.md) Using javascript with function_score ------------------------------------ diff --git a/pom.xml b/pom.xml index 8a6c9a5..91f7388 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.elasticsearch elasticsearch-lang-javascript - 2.3.0-SNAPSHOT + 2.4.0-SNAPSHOT jar Elasticsearch JavaScript language plugin The JavaScript language plugin allows to have javascript as the language of scripts to execute. @@ -32,7 +32,7 @@ - 1.3.0 + 1.4.0-SNAPSHOT 4.9.0 1 true diff --git a/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java b/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java index 7b564e0..a434f1e 100644 --- a/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java +++ b/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java @@ -234,11 +234,6 @@ public void setNextDocId(int doc) { lookup.setNextDocId(doc); } - @Override - public void setNextScore(float score) { - ScriptableObject.putProperty(scope, "_score", score); - } - @Override public void setNextVar(String name, Object value) { ScriptableObject.putProperty(scope, name, value); From 28cbf3a01181a46d6b6bfc1871465368c0238ef7 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Thu, 4 Sep 2014 15:09:02 +0200 Subject: [PATCH 09/31] Docs: make the welcome page more obvious Closes #25. --- .gitignore | 1 + README.md | 18 +- dev-tools/build_release.py | 722 ------------------------------------- dev-tools/release.py | 134 +++++++ dev-tools/upload-s3.py | 67 ---- 5 files changed, 138 insertions(+), 804 deletions(-) delete mode 100755 dev-tools/build_release.py create mode 100644 dev-tools/release.py delete mode 100644 dev-tools/upload-s3.py diff --git a/.gitignore b/.gitignore index 6d851a6..ee44051 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.classpath /.settings .local-execution-hints.log +/plugin_tools diff --git a/README.md b/README.md index a3c883c..e5eb450 100644 --- a/README.md +++ b/README.md @@ -3,23 +3,11 @@ JavaScript lang Plugin for Elasticsearch The JavaScript language plugin allows to have `javascript` (or `js`) as the language of scripts to execute. -In order to install the plugin, simply run: `bin/plugin -install elasticsearch/elasticsearch-lang-javascript/2.1.0`. +## Version 2.4.0-SNAPSHOT for Elasticsearch: 1.x -* For master elasticsearch versions, look at [master branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/master). -* For 1.4.x elasticsearch versions, look at [es-1.4 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.4). -* For 1.3.x elasticsearch versions, look at [es-1.3 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.3). -* For 1.2.x elasticsearch versions, look at [es-1.2 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.2). -* For 1.1.x elasticsearch versions, look at [es-1.1 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.1). -* For 1.0.x elasticsearch versions, look at [es-1.0 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-1.0). -* For 0.90.x elasticsearch versions, look at [es-0.90 branch](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/es-0.90). +If you are looking for another version documentation, please refer to the +[compatibility matrix](http://github.com/elasticsearch/elasticsearch-lang-javascript#javascript-lang-plugin-for-elasticsearch). -| JavaScript Lang Plugin | elasticsearch | rhino | Release date | -|-----------------------------|---------------------|----------|:------------:| -| 2.4.0-SNAPSHOT | 1.4.0 -> 1.4 | 1.7R4 | XXXX-XX-XX | - -Please read documentation relative to the version you are using: - -* [2.4.0-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-lang-javascript/blob/es-1.4/README.md) Using javascript with function_score ------------------------------------ diff --git a/dev-tools/build_release.py b/dev-tools/build_release.py deleted file mode 100755 index db83454..0000000 --- a/dev-tools/build_release.py +++ /dev/null @@ -1,722 +0,0 @@ -# Licensed to Elasticsearch under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on -# an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -# either express or implied. See the License for the specific -# language governing permissions and limitations under the License. - -import re -import tempfile -import shutil -import os -import datetime -import argparse -import github3 -import smtplib - -from email.mime.multipart import MIMEMultipart -from email.mime.text import MIMEText - -from os.path import dirname, abspath - -""" - This tool builds a release from the a given elasticsearch plugin branch. - In order to execute it go in the top level directory and run: - $ python3 dev_tools/build_release.py --branch master --publish --remote origin - - By default this script runs in 'dry' mode which essentially simulates a release. If the - '--publish' option is set the actual release is done. - If not in 'dry' mode, a mail will be automatically sent to the mailing list. - You can disable it with the option '--disable_mail' - - $ python3 dev_tools/build_release.py --publish --remote origin --disable_mail - - The script takes over almost all - steps necessary for a release from a high level point of view it does the following things: - - - run prerequisite checks ie. check for S3 credentials available as env variables - - detect the version to release from the specified branch (--branch) or the current branch - - creates a release branch & updates pom.xml and README.md to point to a release version rather than a snapshot - - builds the artifacts - - commits the new version and merges the release branch into the source branch - - creates a tag and pushes the commit to the specified origin (--remote) - - publishes the releases to sonatype and S3 - - send a mail based on github issues fixed by this version - -Once it's done it will print all the remaining steps. - - Prerequisites: - - Python 3k for script execution - - Boto for S3 Upload ($ apt-get install python-boto or pip-3.3 install boto) - - github3 module (pip-3.3 install github3.py) - - S3 keys exported via ENV Variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) - - GITHUB (login/password) or key exported via ENV Variables (GITHUB_LOGIN, GITHUB_PASSWORD or GITHUB_KEY) - (see https://github.com/settings/applications#personal-access-tokens) - Optional: default to no authentication - - SMTP_HOST - Optional: default to localhost - - MAIL_SENDER - Optional: default to 'david@pilato.fr': must be authorized to send emails to elasticsearch mailing list - - MAIL_TO - Optional: default to 'elasticsearch@googlegroups.com' -""" -env = os.environ - -LOG = env.get('ES_RELEASE_LOG', '/tmp/elasticsearch_release.log') -ROOT_DIR = os.path.join(abspath(dirname(__file__)), '../') -README_FILE = ROOT_DIR + 'README.md' -POM_FILE = ROOT_DIR + 'pom.xml' - -def log(msg): - log_plain('\n%s' % msg) - -def log_plain(msg): - f = open(LOG, mode='ab') - f.write(msg.encode('utf-8')) - f.close() - -def run(command, quiet=False): - log('%s: RUN: %s\n' % (datetime.datetime.now(), command)) - if os.system('%s >> %s 2>&1' % (command, LOG)): - msg = ' FAILED: %s [see log %s]' % (command, LOG) - if not quiet: - print(msg) - raise RuntimeError(msg) - -try: - JAVA_HOME = env['JAVA_HOME'] -except KeyError: - raise RuntimeError(""" - Please set JAVA_HOME in the env before running release tool - On OSX use: export JAVA_HOME=`/usr/libexec/java_home -v '1.6*'`""") - -try: - MVN='mvn' - # make sure mvn3 is used if mvn3 is available - # some systems use maven 2 as default - run('mvn3 --version', quiet=True) - MVN='mvn3' -except RuntimeError: - pass - - -def java_exe(): - path = JAVA_HOME - return 'export JAVA_HOME="%s" PATH="%s/bin:$PATH" JAVACMD="%s/bin/java"' % (path, path, path) - -# Returns the hash of the current git HEAD revision -def get_head_hash(): - return os.popen(' git rev-parse --verify HEAD 2>&1').read().strip() - -# Returns the hash of the given tag revision -def get_tag_hash(tag): - return os.popen('git show-ref --tags %s --hash 2>&1' % (tag)).read().strip() - -# Returns the name of the current branch -def get_current_branch(): - return os.popen('git rev-parse --abbrev-ref HEAD 2>&1').read().strip() - -# Utility that returns the name of the release branch for a given version -def release_branch(version): - return 'release_branch_%s' % version - -# runs get fetch on the given remote -def fetch(remote): - run('git fetch %s' % remote) - -# Creates a new release branch from the given source branch -# and rebases the source branch from the remote before creating -# the release branch. Note: This fails if the source branch -# doesn't exist on the provided remote. -def create_release_branch(remote, src_branch, release): - run('git checkout %s' % src_branch) - run('git pull --rebase %s %s' % (remote, src_branch)) - run('git checkout -b %s' % (release_branch(release))) - - -# Reads the given file and applies the -# callback to it. If the callback changed -# a line the given file is replaced with -# the modified input. -def process_file(file_path, line_callback): - fh, abs_path = tempfile.mkstemp() - modified = False - with open(abs_path,'w', encoding='utf-8') as new_file: - with open(file_path, encoding='utf-8') as old_file: - for line in old_file: - new_line = line_callback(line) - modified = modified or (new_line != line) - new_file.write(new_line) - os.close(fh) - if modified: - #Remove original file - os.remove(file_path) - #Move new file - shutil.move(abs_path, file_path) - return True - else: - # nothing to do - just remove the tmp file - os.remove(abs_path) - return False - -# Guess the next snapshot version number (increment second digit) -def guess_snapshot(version): - digits=list(map(int, re.findall(r'\d+', version))) - source='%s.%s' % (digits[0], digits[1]) - destination='%s.%s' % (digits[0], digits[1]+1) - return version.replace(source, destination) - -# Moves the pom.xml file from a snapshot to a release -def remove_maven_snapshot(pom, release): - pattern = '%s-SNAPSHOT' % release - replacement = '%s' % release - def callback(line): - return line.replace(pattern, replacement) - process_file(pom, callback) - -# Moves the README.md file from a snapshot to a release -def remove_version_snapshot(readme_file, release): - pattern = '%s-SNAPSHOT' % release - replacement = '%s ' % release - def callback(line): - return line.replace(pattern, replacement) - process_file(readme_file, callback) - -# Moves the pom.xml file to the next snapshot -def add_maven_snapshot(pom, release, snapshot): - pattern = '%s' % release - replacement = '%s-SNAPSHOT' % snapshot - def callback(line): - return line.replace(pattern, replacement) - process_file(pom, callback) - -# Add in README.md file the next snapshot -def add_version_snapshot(readme_file, release, snapshot): - pattern = '| %s ' % release - replacement = '| %s-SNAPSHOT' % snapshot - def callback(line): - # If we find pattern, we copy the line and replace its content - if line.find(pattern) >= 0: - return line.replace(pattern, replacement).replace('%s' % (datetime.datetime.now().strftime("%Y-%m-%d")), - 'XXXX-XX-XX')+line - else: - return line - process_file(readme_file, callback) - -# Moves the README.md file from a snapshot to a release (documentation link) -def remove_documentation_snapshot(readme_file, repo_url, release, branch): - pattern = '* [%s-SNAPSHOT](%sblob/%s/README.md)' % (release, repo_url, branch) - replacement = '* [%s](%sblob/v%s/README.md)' % (release, repo_url, release) - def callback(line): - # If we find pattern, we replace its content - if line.find(pattern) >= 0: - return line.replace(pattern, replacement) - else: - return line - process_file(readme_file, callback) - -# Add in README.markdown file the documentation for the next version -def add_documentation_snapshot(readme_file, repo_url, release, snapshot, branch): - pattern = '* [%s](%sblob/v%s/README.md)' % (release, repo_url, release) - replacement = '* [%s-SNAPSHOT](%sblob/%s/README.md)' % (snapshot, repo_url, branch) - def callback(line): - # If we find pattern, we copy the line and replace its content - if line.find(pattern) >= 0: - return line.replace(pattern, replacement)+line - else: - return line - process_file(readme_file, callback) - -# Set release date in README.md file -def set_date(readme_file): - pattern = 'XXXX-XX-XX' - replacement = '%s' % (datetime.datetime.now().strftime("%Y-%m-%d")) - def callback(line): - return line.replace(pattern, replacement) - process_file(readme_file, callback) - -# Update installation instructions in README.md file -def set_install_instructions(readme_file, artifact_name, release): - pattern = '`bin/plugin -install elasticsearch/%s/.+`' % artifact_name - replacement = '`bin/plugin -install elasticsearch/%s/%s`' % (artifact_name, release) - def callback(line): - return re.sub(pattern, replacement, line) - process_file(readme_file, callback) - - -# Stages the given files for the next git commit -def add_pending_files(*files): - for file in files: - run('git add %s' % file) - -# Executes a git commit with 'release [version]' as the commit message -def commit_release(artifact_id, release): - run('git commit -m "prepare release %s-%s"' % (artifact_id, release)) - -def commit_snapshot(): - run('git commit -m "prepare for next development iteration"') - -def tag_release(release): - run('git tag -a v%s -m "Tag release version %s"' % (release, release)) - -def run_mvn(*cmd): - for c in cmd: - run('%s; %s -f %s %s' % (java_exe(), MVN, POM_FILE, c)) - -def build_release(run_tests=False, dry_run=True): - target = 'deploy' - if dry_run: - target = 'package' - if run_tests: - run_mvn('clean test') - run_mvn('clean %s -DskipTests' %(target)) - -# Checks the pom.xml for the release version. 2.0.0-SNAPSHOT -# This method fails if the pom file has no SNAPSHOT version set ie. -# if the version is already on a release version we fail. -# Returns the next version string ie. 0.90.7 -def find_release_version(src_branch): - run('git checkout %s' % src_branch) - with open(POM_FILE, encoding='utf-8') as file: - for line in file: - match = re.search(r'(.+)-SNAPSHOT', line) - if match: - return match.group(1) - raise RuntimeError('Could not find release version in branch %s' % src_branch) - -# extract a value from pom.xml -def find_from_pom(tag): - with open(POM_FILE, encoding='utf-8') as file: - for line in file: - match = re.search(r'<%s>(.+)' % (tag, tag), line) - if match: - return match.group(1) - raise RuntimeError('Could not find <%s> in pom.xml file' % (tag)) - -def get_artifacts(artifact_id, release): - artifact_path = ROOT_DIR + 'target/releases/%s-%s.zip' % (artifact_id, release) - print(' Path %s' % (artifact_path)) - if not os.path.isfile(artifact_path): - raise RuntimeError('Could not find required artifact at %s' % (artifact_path)) - return artifact_path - -# Generates sha1 for a file -# and returns the checksum files as well -# as the given files in a list -def generate_checksums(release_file): - res = [] - directory = os.path.dirname(release_file) - file = os.path.basename(release_file) - checksum_file = '%s.sha1.txt' % file - - if os.system('cd %s; shasum %s > %s' % (directory, file, checksum_file)): - raise RuntimeError('Failed to generate checksum for file %s' % release_file) - res = res + [os.path.join(directory, checksum_file), release_file] - return res - -def git_merge(src_branch, release_version): - run('git checkout %s' % src_branch) - run('git merge %s' % release_branch(release_version)) - -def git_push(remote, src_branch, release_version, dry_run): - if not dry_run: - run('git push %s %s' % (remote, src_branch)) # push the commit - run('git push %s v%s' % (remote, release_version)) # push the tag - else: - print(' dryrun [True] -- skipping push to remote %s' % remote) - -def publish_artifacts(artifacts, base='elasticsearch/elasticsearch', dry_run=True): - location = os.path.dirname(os.path.realpath(__file__)) - for artifact in artifacts: - if dry_run: - print('Skip Uploading %s to Amazon S3 in %s' % (artifact, base)) - else: - print('Uploading %s to Amazon S3' % artifact) - # requires boto to be installed but it is not available on python3k yet so we use a dedicated tool - run('python %s/upload-s3.py --file %s --path %s' % (location, os.path.abspath(artifact), base)) - - -################# -## -## -## Email and Github Management -## -## -################# -def format_issues_plain(issues, title='Fix'): - response = "" - - if len(issues) > 0: - response += '%s:\n' % title - for issue in issues: - response += ' * [%s] - %s (%s)\n' % (issue.number, issue.title, issue.html_url) - - return response - -def format_issues_html(issues, title='Fix'): - response = "" - - if len(issues) > 0: - response += '

%s

\n
    \n' % title - for issue in issues: - response += '
  • [%s] - %s\n' % (issue.html_url, issue.number, issue.title) - response += '
\n' - - return response - -def get_github_repository(reponame, - login=env.get('GITHUB_LOGIN', None), - password=env.get('GITHUB_PASSWORD', None), - key=env.get('GITHUB_KEY', None)): - if login: - g = github3.login(login, password) - elif key: - g = github3.login(token=key) - else: - g = github3.GitHub() - - return g.repository("elasticsearch", reponame) - -# Check if there are some remaining open issues and fails -def check_opened_issues(version, repository, reponame): - opened_issues = [i for i in repository.iter_issues(state='open', labels='%s' % version)] - if len(opened_issues)>0: - raise NameError('Some issues [%s] are still opened. Check https://github.com/elasticsearch/%s/issues?labels=%s&state=open' - % (len(opened_issues), reponame, version)) - -# List issues from github: can be done anonymously if you don't -# exceed a given number of github API calls per day -# Check if there are some remaining open issues and fails -def list_issues(version, - repository, - severity='bug'): - issues = [i for i in repository.iter_issues(state='closed', labels='%s,%s' % (severity, version))] - return issues - -# Get issues from github and generates a Plain/HTML Multipart email -# And send it if dry_run=False -def prepare_email(artifact_id, release_version, repository, - artifact_name, artifact_description, project_url, - severity_labels_bug='bug', - severity_labels_update='update', - severity_labels_new='new', - severity_labels_doc='doc'): - - ## Get bugs from github - issues_bug = list_issues(release_version, repository, severity=severity_labels_bug) - issues_update = list_issues(release_version, repository, severity=severity_labels_update) - issues_new = list_issues(release_version, repository, severity=severity_labels_new) - issues_doc = list_issues(release_version, repository, severity=severity_labels_doc) - - ## Format content to plain text - plain_issues_bug = format_issues_plain(issues_bug, 'Fix') - plain_issues_update = format_issues_plain(issues_update, 'Update') - plain_issues_new = format_issues_plain(issues_new, 'New') - plain_issues_doc = format_issues_plain(issues_doc, 'Doc') - - ## Format content to html - html_issues_bug = format_issues_html(issues_bug, 'Fix') - html_issues_update = format_issues_html(issues_update, 'Update') - html_issues_new = format_issues_html(issues_new, 'New') - html_issues_doc = format_issues_html(issues_doc, 'Doc') - - if len(issues_bug)+len(issues_update)+len(issues_new)+len(issues_doc) > 0: - plain_empty_message = "" - html_empty_message = "" - - else: - plain_empty_message = "No issue listed for this release" - html_empty_message = "

No issue listed for this release

" - - msg = MIMEMultipart('alternative') - msg['Subject'] = '[ANN] %s %s released' % (artifact_name, release_version) - text = """ -Heya, - - -We are pleased to announce the release of the %(artifact_name)s, version %(release_version)s. - -%(artifact_description)s. - -%(project_url)s - -Release Notes - %(artifact_id)s - Version %(release_version)s - -%(empty_message)s -%(issues_bug)s -%(issues_update)s -%(issues_new)s -%(issues_doc)s - -Issues, Pull requests, Feature requests are warmly welcome on %(artifact_id)s project repository: %(project_url)s -For questions or comments around this plugin, feel free to use elasticsearch mailing list: https://groups.google.com/forum/#!forum/elasticsearch - -Enjoy, - --The Elasticsearch team -""" % {'release_version': release_version, - 'artifact_id': artifact_id, - 'artifact_name': artifact_name, - 'artifact_description': artifact_description, - 'project_url': project_url, - 'empty_message': plain_empty_message, - 'issues_bug': plain_issues_bug, - 'issues_update': plain_issues_update, - 'issues_new': plain_issues_new, - 'issues_doc': plain_issues_doc} - - html = """ - - -

Heya,

- -

We are pleased to announce the release of the %(artifact_name)s, version %(release_version)s

- -
%(artifact_description)s.
- -

Release Notes - Version %(release_version)s

-%(empty_message)s -%(issues_bug)s -%(issues_update)s -%(issues_new)s -%(issues_doc)s - -

Issues, Pull requests, Feature requests are warmly welcome on -%(artifact_id)s project repository!

-

For questions or comments around this plugin, feel free to use elasticsearch -mailing list!

- -

Enjoy,

- -

- The Elasticsearch team

- -""" % {'release_version': release_version, - 'artifact_id': artifact_id, - 'artifact_name': artifact_name, - 'artifact_description': artifact_description, - 'project_url': project_url, - 'empty_message': html_empty_message, - 'issues_bug': html_issues_bug, - 'issues_update': html_issues_update, - 'issues_new': html_issues_new, - 'issues_doc': html_issues_doc} - - # Record the MIME types of both parts - text/plain and text/html. - part1 = MIMEText(text, 'plain') - part2 = MIMEText(html, 'html') - - # Attach parts into message container. - # According to RFC 2046, the last part of a multipart message, in this case - # the HTML message, is best and preferred. - msg.attach(part1) - msg.attach(part2) - - return msg - -def send_email(msg, - dry_run=True, - mail=True, - sender=env.get('MAIL_SENDER'), - to=env.get('MAIL_TO', 'elasticsearch@googlegroups.com'), - smtp_server=env.get('SMTP_SERVER', 'localhost')): - msg['From'] = 'Elasticsearch Team <%s>' % sender - msg['To'] = 'Elasticsearch Mailing List <%s>' % to - # save mail on disk - with open(ROOT_DIR+'target/email.txt', 'w') as email_file: - email_file.write(msg.as_string()) - if mail and not dry_run: - s = smtplib.SMTP(smtp_server, 25) - s.sendmail(sender, to, msg.as_string()) - s.quit() - else: - print('generated email: open %starget/email.txt' % ROOT_DIR) - -def print_sonatype_notice(): - settings = os.path.join(os.path.expanduser('~'), '.m2/settings.xml') - if os.path.isfile(settings): - with open(settings, encoding='utf-8') as settings_file: - for line in settings_file: - if line.strip() == 'sonatype-nexus-snapshots': - # moving out - we found the indicator no need to print the warning - return - print(""" - NOTE: No sonatype settings detected, make sure you have configured - your sonatype credentials in '~/.m2/settings.xml': - - - ... - - - sonatype-nexus-snapshots - your-jira-id - your-jira-pwd - - - sonatype-nexus-staging - your-jira-id - your-jira-pwd - - - ... - - """) - -def check_s3_credentials(): - if not env.get('AWS_ACCESS_KEY_ID', None) or not env.get('AWS_SECRET_ACCESS_KEY', None): - raise RuntimeError('Could not find "AWS_ACCESS_KEY_ID" / "AWS_SECRET_ACCESS_KEY" in the env variables please export in order to upload to S3') - -def check_github_credentials(): - if not env.get('GITHUB_KEY', None) and not env.get('GITHUB_LOGIN', None): - log('WARN: Could not find "GITHUB_LOGIN" / "GITHUB_PASSWORD" or "GITHUB_KEY" in the env variables. You could need it.') - -def check_email_settings(): - if not env.get('MAIL_SENDER', None): - raise RuntimeError('Could not find "MAIL_SENDER"') - -# we print a notice if we can not find the relevant infos in the ~/.m2/settings.xml -print_sonatype_notice() - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Builds and publishes a Elasticsearch Plugin Release') - parser.add_argument('--branch', '-b', metavar='master', default=get_current_branch(), - help='The branch to release from. Defaults to the current branch.') - parser.add_argument('--skiptests', '-t', dest='tests', action='store_false', - help='Skips tests before release. Tests are run by default.') - parser.set_defaults(tests=True) - parser.add_argument('--remote', '-r', metavar='origin', default='origin', - help='The remote to push the release commit and tag to. Default is [origin]') - parser.add_argument('--publish', '-p', dest='dryrun', action='store_false', - help='Publishes the release. Disable by default.') - parser.add_argument('--disable_mail', '-dm', dest='mail', action='store_false', - help='Do not send a release email. Email is sent by default.') - - parser.set_defaults(dryrun=True) - parser.set_defaults(mail=True) - args = parser.parse_args() - - src_branch = args.branch - remote = args.remote - run_tests = args.tests - dry_run = args.dryrun - mail = args.mail - - if not dry_run: - check_s3_credentials() - print('WARNING: dryrun is set to "false" - this will push and publish the release') - if mail: - check_email_settings() - print('An email to %s will be sent after the release' - % env.get('MAIL_TO', 'elasticsearch@googlegroups.com')) - input('Press Enter to continue...') - - check_github_credentials() - - print(''.join(['-' for _ in range(80)])) - print('Preparing Release from branch [%s] running tests: [%s] dryrun: [%s]' % (src_branch, run_tests, dry_run)) - print(' JAVA_HOME is [%s]' % JAVA_HOME) - print(' Running with maven command: [%s] ' % (MVN)) - - release_version = find_release_version(src_branch) - artifact_id = find_from_pom('artifactId') - artifact_name = find_from_pom('name') - artifact_description = find_from_pom('description') - project_url = find_from_pom('url') - elasticsearch_version = find_from_pom('elasticsearch.version') - print(' Artifact Id: [%s]' % artifact_id) - print(' Release version: [%s]' % release_version) - print(' Elasticsearch: [%s]' % elasticsearch_version) - if elasticsearch_version.find('-SNAPSHOT') != -1: - raise RuntimeError('Can not release with a SNAPSHOT elasticsearch dependency: %s' % elasticsearch_version) - - # extract snapshot - default_snapshot_version = guess_snapshot(release_version) - snapshot_version = input('Enter next snapshot version [%s]:' % default_snapshot_version) - snapshot_version = snapshot_version or default_snapshot_version - - print(' Next version: [%s-SNAPSHOT]' % snapshot_version) - print(' Artifact Name: [%s]' % artifact_name) - print(' Artifact Description: [%s]' % artifact_description) - print(' Project URL: [%s]' % project_url) - - if not dry_run: - smoke_test_version = release_version - head_hash = get_head_hash() - run_mvn('clean') # clean the env! - create_release_branch(remote, src_branch, release_version) - print(' Created release branch [%s]' % (release_branch(release_version))) - success = False - try: - pending_files = [POM_FILE, README_FILE] - remove_maven_snapshot(POM_FILE, release_version) - remove_documentation_snapshot(README_FILE, project_url, release_version, src_branch) - remove_version_snapshot(README_FILE, release_version) - set_date(README_FILE) - set_install_instructions(README_FILE, artifact_id, release_version) - print(' Done removing snapshot version') - add_pending_files(*pending_files) # expects var args use * to expand - commit_release(artifact_id, release_version) - print(' Committed release version [%s]' % release_version) - print(''.join(['-' for _ in range(80)])) - print('Building Release candidate') - input('Press Enter to continue...') - print(' Checking github issues') - repository = get_github_repository(artifact_id) - check_opened_issues(release_version, repository, artifact_id) - if not dry_run: - print(' Running maven builds now and publish to sonatype - run-tests [%s]' % run_tests) - else: - print(' Running maven builds now run-tests [%s]' % run_tests) - build_release(run_tests=run_tests, dry_run=dry_run) - artifact = get_artifacts(artifact_id, release_version) - artifact_and_checksums = generate_checksums(artifact) - print(''.join(['-' for _ in range(80)])) - - print('Finish Release -- dry_run: %s' % dry_run) - input('Press Enter to continue...') - print(' merge release branch') - git_merge(src_branch, release_version) - print(' tag') - tag_release(release_version) - - add_maven_snapshot(POM_FILE, release_version, snapshot_version) - add_version_snapshot(README_FILE, release_version, snapshot_version) - add_documentation_snapshot(README_FILE, project_url, release_version, snapshot_version, src_branch) - add_pending_files(*pending_files) - commit_snapshot() - - print(' push to %s %s -- dry_run: %s' % (remote, src_branch, dry_run)) - git_push(remote, src_branch, release_version, dry_run) - print(' publish artifacts to S3 -- dry_run: %s' % dry_run) - publish_artifacts(artifact_and_checksums, base='elasticsearch/%s' % (artifact_id) , dry_run=dry_run) - print(' preparing email (from github issues)') - msg = prepare_email(artifact_id, release_version, repository, artifact_name, artifact_description, project_url) - print(' sending email -- dry_run: %s, mail: %s' % (dry_run, mail)) - send_email(msg, dry_run=dry_run, mail=mail) - - pending_msg = """ -Release successful pending steps: - * close and release sonatype repo: https://oss.sonatype.org/ - * check if the release is there https://oss.sonatype.org/content/repositories/releases/org/elasticsearch/%(artifact_id)s/%(version)s - * tweet about the release -""" - print(pending_msg % {'version': release_version, - 'artifact_id': artifact_id, - 'project_url': project_url}) - success = True - finally: - if not success: - run('git reset --hard HEAD') - run('git checkout %s' % src_branch) - elif dry_run: - print('End of dry_run') - input('Press Enter to reset changes...') - - run('git reset --hard %s' % head_hash) - run('git tag -d v%s' % release_version) - # we delete this one anyways - run('git branch -D %s' % (release_branch(release_version))) diff --git a/dev-tools/release.py b/dev-tools/release.py new file mode 100644 index 0000000..edcc637 --- /dev/null +++ b/dev-tools/release.py @@ -0,0 +1,134 @@ +# Licensed to Elasticsearch under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on +# an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. + +import datetime +import os +import shutil +import sys +import time +import urllib +import urllib.request +import zipfile + +from os.path import dirname, abspath + +""" + This tool builds a release from the a given elasticsearch plugin branch. + + It is basically a wrapper on top of launch_release.py which: + + - tries to get a more recent version of launch_release.py in ... + - download it if needed + - launch it passing all arguments to it, like: + + $ python3 dev_tools/release.py --branch master --publish --remote origin + + Important options: + + # Dry run + $ python3 dev_tools/release.py + + # Dry run without tests + python3 dev_tools/release.py --skiptests + + # Release, publish artifacts and announce + $ python3 dev_tools/release.py --publish + + See full documentation in launch_release.py +""" +env = os.environ + +# Change this if the source repository for your scripts is at a different location +SOURCE_REPO = 'elasticsearch/elasticsearch-plugins-script' +# We define that we should download again the script after 1 days +SCRIPT_OBSOLETE_DAYS = 1 +# We ignore in master.zip file the following files +IGNORED_FILES = ['.gitignore', 'README.md'] + + +ROOT_DIR = abspath(os.path.join(abspath(dirname(__file__)), '../')) +TARGET_TOOLS_DIR = ROOT_DIR + '/plugin_tools' +DEV_TOOLS_DIR = ROOT_DIR + '/dev-tools' +BUILD_RELEASE_FILENAME = 'release.zip' +BUILD_RELEASE_FILE = TARGET_TOOLS_DIR + '/' + BUILD_RELEASE_FILENAME +SOURCE_URL = 'https://github.com/%s/archive/master.zip' % SOURCE_REPO + +# Download a recent version of the release plugin tool +try: + os.mkdir(TARGET_TOOLS_DIR) + print('directory %s created' % TARGET_TOOLS_DIR) +except FileExistsError: + pass + + +try: + # we check latest update. If we ran an update recently, we + # are not going to check it again + download = True + + try: + last_download_time = datetime.datetime.fromtimestamp(os.path.getmtime(BUILD_RELEASE_FILE)) + if (datetime.datetime.now()-last_download_time).days < SCRIPT_OBSOLETE_DAYS: + download = False + except FileNotFoundError: + pass + + if download: + urllib.request.urlretrieve(SOURCE_URL, BUILD_RELEASE_FILE) + with zipfile.ZipFile(BUILD_RELEASE_FILE) as myzip: + for member in myzip.infolist(): + filename = os.path.basename(member.filename) + # skip directories + if not filename: + continue + if filename in IGNORED_FILES: + continue + + # copy file (taken from zipfile's extract) + source = myzip.open(member.filename) + target = open(os.path.join(TARGET_TOOLS_DIR, filename), "wb") + with source, target: + shutil.copyfileobj(source, target) + # We keep the original date + date_time = time.mktime(member.date_time + (0, 0, -1)) + os.utime(os.path.join(TARGET_TOOLS_DIR, filename), (date_time, date_time)) + print('plugin-tools updated from %s' % SOURCE_URL) +except urllib.error.HTTPError: + pass + + +# Let see if we need to update the release.py script itself +source_time = os.path.getmtime(TARGET_TOOLS_DIR + '/release.py') +repo_time = os.path.getmtime(DEV_TOOLS_DIR + '/release.py') +if source_time > repo_time: + input('release.py needs an update. Press a key to update it...') + shutil.copyfile(TARGET_TOOLS_DIR + '/release.py', DEV_TOOLS_DIR + '/release.py') + +# We can launch the build process +try: + PYTHON = 'python' + # make sure python3 is used if python3 is available + # some systems use python 2 as default + os.system('python3 --version > /dev/null 2>&1') + PYTHON = 'python3' +except RuntimeError: + pass + +release_args = '' +for x in range(1, len(sys.argv)): + release_args += ' ' + sys.argv[x] + +os.system('%s %s/build_release.py %s' % (PYTHON, TARGET_TOOLS_DIR, release_args)) diff --git a/dev-tools/upload-s3.py b/dev-tools/upload-s3.py deleted file mode 100644 index 95ea576..0000000 --- a/dev-tools/upload-s3.py +++ /dev/null @@ -1,67 +0,0 @@ -# Licensed to Elasticsearch under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on -# an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -# either express or implied. See the License for the specific -# language governing permissions and limitations under the License. - -import os -import sys -import argparse -try: - import boto.s3 -except: - raise RuntimeError(""" - S3 upload requires boto to be installed - Use one of: - 'pip install -U boto' - 'apt-get install python-boto' - 'easy_install boto' - """) - -import boto.s3 - - -def list_buckets(conn): - return conn.get_all_buckets() - - -def upload_s3(conn, path, key, file, bucket): - print 'Uploading %s to Amazon S3 bucket %s/%s' % \ - (file, bucket, os.path.join(path, key)) - def percent_cb(complete, total): - sys.stdout.write('.') - sys.stdout.flush() - bucket = conn.create_bucket(bucket) - k = bucket.new_key(os.path.join(path, key)) - k.set_contents_from_filename(file, cb=percent_cb, num_cb=100) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Uploads files to Amazon S3') - parser.add_argument('--file', '-f', metavar='path to file', - help='the branch to release from', required=True) - parser.add_argument('--bucket', '-b', metavar='B42', default='download.elasticsearch.org', - help='The S3 Bucket to upload to') - parser.add_argument('--path', '-p', metavar='elasticsearch/elasticsearch', default='elasticsearch/elasticsearch', - help='The key path to use') - parser.add_argument('--key', '-k', metavar='key', default=None, - help='The key - uses the file name as default key') - args = parser.parse_args() - if args.key: - key = args.key - else: - key = os.path.basename(args.file) - - connection = boto.connect_s3() - upload_s3(connection, args.path, key, args.file, args.bucket); - From 1eb2352c87560d85a60ee4c7c0111d30089c7542 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Mon, 15 Sep 2014 16:28:28 +0200 Subject: [PATCH 10/31] Update to Lucene 4.10.0 Closes #27. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 91f7388..6ba6fd8 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ 1.4.0-SNAPSHOT - 4.9.0 + 4.10.0 1 true onerror From f645138087be11b189af2f57d63a95076ad8a5a5 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Mon, 15 Sep 2014 16:29:03 +0200 Subject: [PATCH 11/31] Create branch es-1.4 for elasticsearch 1.4.0 --- README.md | 2 +- pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e5eb450..f2b6c03 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ JavaScript lang Plugin for Elasticsearch The JavaScript language plugin allows to have `javascript` (or `js`) as the language of scripts to execute. -## Version 2.4.0-SNAPSHOT for Elasticsearch: 1.x +## Version 2.5.0-SNAPSHOT for Elasticsearch: 1.x If you are looking for another version documentation, please refer to the [compatibility matrix](http://github.com/elasticsearch/elasticsearch-lang-javascript#javascript-lang-plugin-for-elasticsearch). diff --git a/pom.xml b/pom.xml index 6ba6fd8..dbb885e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.elasticsearch elasticsearch-lang-javascript - 2.4.0-SNAPSHOT + 2.5.0-SNAPSHOT jar Elasticsearch JavaScript language plugin The JavaScript language plugin allows to have javascript as the language of scripts to execute. @@ -32,7 +32,7 @@ - 1.4.0-SNAPSHOT + 1.5.0-SNAPSHOT 4.10.0 1 true From 7fea842e4b6b0d1504158d93bc801aa820dbf45e Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Wed, 24 Sep 2014 18:04:14 -0400 Subject: [PATCH 12/31] Upgrade to Lucene 4.10.1 snapshot --- pom.xml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index dbb885e..b61cf29 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,8 @@ 1.5.0-SNAPSHOT - 4.10.0 + 4.10.1 + 4.10.1-snapshot-1627368 1 true onerror @@ -42,6 +43,10 @@ + + Lucene snapshots + https://download.elasticsearch.org/lucenesnapshots/ + sonatype http://oss.sonatype.org/content/repositories/releases/ @@ -52,7 +57,7 @@ org.apache.lucene lucene-test-framework - ${lucene.version} + ${lucene.maven.version} test From a8db11954e508d7812142657e78a52037ce3943c Mon Sep 17 00:00:00 2001 From: mikemccand Date: Sun, 28 Sep 2014 17:57:46 -0400 Subject: [PATCH 13/31] Upgrade to Lucene 4.10.1 --- pom.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index b61cf29..c4dfc61 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ 1.5.0-SNAPSHOT 4.10.1 - 4.10.1-snapshot-1627368 + 4.10.1 1 true onerror @@ -43,10 +43,6 @@ - - Lucene snapshots - https://download.elasticsearch.org/lucenesnapshots/ - sonatype http://oss.sonatype.org/content/repositories/releases/ From cab88e9b4ffa615fb9e70c4af7886ecb4897ba68 Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Tue, 7 Oct 2014 12:26:54 +0200 Subject: [PATCH 14/31] Remove setNextScore in SearchScript Due to a change in elasticsearch 1.4.0, we need to apply a similar patch here. See https://github.com/elasticsearch/elasticsearch/pull/6864 See https://github.com/elasticsearch/elasticsearch/pull/7819 Closes #23. (cherry picked from commit 5e5c373) --- .../JavaScriptScriptEngineService.java | 5 +- .../JavaScriptScriptSearchTests.java | 49 +++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java b/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java index a434f1e..2b8f696 100644 --- a/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java +++ b/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java @@ -26,6 +26,7 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.script.ExecutableScript; +import org.elasticsearch.script.ScoreAccessor; import org.elasticsearch.script.ScriptEngineService; import org.elasticsearch.script.SearchScript; import org.elasticsearch.script.javascript.support.NativeList; @@ -221,7 +222,9 @@ public JavaScriptSearchScript(Script script, Scriptable scope, SearchLookup look @Override public void setScorer(Scorer scorer) { - lookup.setScorer(scorer); + Context ctx = Context.enter(); + ScriptableObject.putProperty(scope, "_score", wrapFactory.wrapAsJavaObject(ctx, scope, new ScoreAccessor(scorer), ScoreAccessor.class)); + Context.exit(); } @Override diff --git a/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java b/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java index 1a04f5e..ec41b10 100644 --- a/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java +++ b/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java @@ -25,10 +25,12 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders; import org.elasticsearch.plugins.PluginsService; +import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -37,8 +39,12 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.FilterBuilders.scriptFilter; import static org.elasticsearch.index.query.QueryBuilders.*; +import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.scriptFunction; +import static org.elasticsearch.search.aggregations.AggregationBuilders.terms; import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource; +import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; /** * @@ -236,4 +242,47 @@ public void testCustomScriptBoost() throws Exception { logger.info(" --> Hit[0] {} Explanation {}", response.getHits().getAt(0).id(), response.getHits().getAt(0).explanation()); logger.info(" --> Hit[1] {} Explanation {}", response.getHits().getAt(1).id(), response.getHits().getAt(1).explanation()); } + + @Test + public void testScriptScoresNested() throws IOException { + createIndex("index"); + ensureYellow(); + index("index", "testtype", "1", jsonBuilder().startObject().field("dummy_field", 1).endObject()); + refresh(); + SearchResponse response = client().search( + searchRequest().source( + searchSource().query( + functionScoreQuery( + functionScoreQuery( + functionScoreQuery().add(scriptFunction("1").lang("js"))) + .add(scriptFunction("_score.doubleValue()").lang("js"))) + .add(scriptFunction("_score.doubleValue()").lang("js") + ) + ) + ) + ).actionGet(); + assertSearchResponse(response); + assertThat(response.getHits().getAt(0).score(), equalTo(1.0f)); + } + + @Test + public void testScriptScoresWithAgg() throws IOException { + createIndex("index"); + ensureYellow(); + index("index", "testtype", "1", jsonBuilder().startObject().field("dummy_field", 1).endObject()); + refresh(); + SearchResponse response = client().search( + searchRequest().source( + searchSource().query( + functionScoreQuery() + .add(scriptFunction("_score.doubleValue()").lang("js") + ) + ).aggregation(terms("score_agg").script("_score.doubleValue()").lang("js")) + ) + ).actionGet(); + assertSearchResponse(response); + assertThat(response.getHits().getAt(0).score(), equalTo(1.0f)); + assertThat(((Terms) response.getAggregations().asMap().get("score_agg")).getBuckets().get(0).getKeyAsNumber().floatValue(), is(1f)); + assertThat(((Terms) response.getAggregations().asMap().get("score_agg")).getBuckets().get(0).getDocCount(), is(1l)); + } } From 9a64e7b7e3d83a1ba96bccdf8b6d71f0d62775fc Mon Sep 17 00:00:00 2001 From: David Pilato Date: Wed, 15 Oct 2014 17:38:27 +0200 Subject: [PATCH 15/31] Implement new method `scriptRemoved(CompiledScript)` in `ScriptEngineService` This [PR](https://github.com/elasticsearch/elasticsearch/pull/8062) broke ScriptEngineService by adding a new method `scriptRemoved(CompiledScript)`. Closes #29. (cherry picked from commit 1fd05bc) --- .../javascript/JavaScriptScriptEngineService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java b/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java index 2b8f696..344b60e 100644 --- a/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java +++ b/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java @@ -25,10 +25,7 @@ import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.script.ExecutableScript; -import org.elasticsearch.script.ScoreAccessor; -import org.elasticsearch.script.ScriptEngineService; -import org.elasticsearch.script.SearchScript; +import org.elasticsearch.script.*; import org.elasticsearch.script.javascript.support.NativeList; import org.elasticsearch.script.javascript.support.NativeMap; import org.elasticsearch.script.javascript.support.ScriptValueConverter; @@ -72,6 +69,11 @@ public void close() { } + @Override + public void scriptRemoved(@Nullable CompiledScript compiledScript) { + // Nothing to do here + } + @Override public String[] types() { return new String[]{"js", "javascript"}; From 147000769f64f908c5a3d18ca501becf1bbe8005 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Thu, 30 Oct 2014 05:55:56 -0400 Subject: [PATCH 16/31] Upgrade to Lucene 4.10.2 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index c4dfc61..21aaecf 100644 --- a/pom.xml +++ b/pom.xml @@ -33,8 +33,8 @@ 1.5.0-SNAPSHOT - 4.10.1 - 4.10.1 + 4.10.2 + 4.10.2 1 true onerror From af4536423351118de034d943771d13e29965b17d Mon Sep 17 00:00:00 2001 From: tlrx Date: Mon, 3 Nov 2014 11:29:22 +0100 Subject: [PATCH 17/31] [TESTS] Upgrade randomizedtesting-runner to 2.1.10 Closes #30 (cherry picked from commit 1cd0420) --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index 21aaecf..9ab48a9 100644 --- a/pom.xml +++ b/pom.xml @@ -100,6 +100,12 @@ 1.3.RC2 test + + com.carrotsearch.randomizedtesting + randomizedtesting-runner + 2.1.10 + test + From 2fcd018cfc4e626965edfcc700e87e36a4added9 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Mon, 10 Nov 2014 18:23:12 -0500 Subject: [PATCH 18/31] Upgrade to Lucene 4.10.3-snapshot-1637985 --- pom.xml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9ab48a9..8b661ab 100644 --- a/pom.xml +++ b/pom.xml @@ -33,8 +33,8 @@ 1.5.0-SNAPSHOT - 4.10.2 - 4.10.2 + 4.10.3 + 4.10.3-snapshot-1637985 1 true onerror @@ -43,6 +43,10 @@ + + Lucene snapshots + https://download.elasticsearch.org/lucenesnapshots/1637985/ + sonatype http://oss.sonatype.org/content/repositories/releases/ From 29149b5e9a1324fef2d94f9aad1686064f8ce240 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Thu, 27 Nov 2014 16:39:53 +0100 Subject: [PATCH 19/31] Improve wrapping of lists. With the current way that Java lists are wrapped into a Scriptable, all methods that are not defined on the java.util.List interface are hidden. This pull request makes NativeList extend NativeJavaObject in order to use reflection in order to look up properties that would not be defined on the List interface. Close #32 --- .../JavaScriptScriptEngineService.java | 4 +- .../script/javascript/support/NativeList.java | 92 ++++--------------- .../script/javascript/support/NativeMap.java | 2 +- .../support/ScriptValueConverter.java | 2 +- .../JavaScriptScriptSearchTests.java | 13 +++ 5 files changed, 34 insertions(+), 79 deletions(-) diff --git a/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java b/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java index 344b60e..7d5df79 100644 --- a/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java +++ b/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java @@ -292,10 +292,10 @@ public CustomWrapFactory() { public Scriptable wrapAsJavaObject(Context cx, Scriptable scope, Object javaObject, Class staticType) { if (javaObject instanceof Map) { - return new NativeMap(scope, (Map) javaObject); + return NativeMap.wrap(scope, (Map) javaObject); } if (javaObject instanceof List) { - return new NativeList(scope, (List) javaObject); + return NativeList.wrap(scope, (List) javaObject, staticType); } return super.wrapAsJavaObject(cx, scope, javaObject, staticType); } diff --git a/src/main/java/org/elasticsearch/script/javascript/support/NativeList.java b/src/main/java/org/elasticsearch/script/javascript/support/NativeList.java index bd1124f..1bf555d 100644 --- a/src/main/java/org/elasticsearch/script/javascript/support/NativeList.java +++ b/src/main/java/org/elasticsearch/script/javascript/support/NativeList.java @@ -19,29 +19,30 @@ package org.elasticsearch.script.javascript.support; +import org.mozilla.javascript.NativeJavaObject; import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.Undefined; import org.mozilla.javascript.Wrapper; +import java.util.Arrays; import java.util.List; /** * */ -public class NativeList implements Scriptable, Wrapper { +public class NativeList extends NativeJavaObject implements Scriptable, Wrapper { private static final long serialVersionUID = 3664761893203964569L; + private static final String LENGTH_PROPERTY = "length"; - private List list; - private Scriptable parentScope; - private Scriptable prototype; + private final List list; - public static NativeList wrap(Scriptable scope, List list) { - return new NativeList(scope, list); + public static NativeList wrap(Scriptable scope, List list, Class staticType) { + return new NativeList(scope, list, staticType); } - public NativeList(Scriptable scope, List list) { - this.parentScope = scope; + private NativeList(Scriptable scope, List list, Class staticType) { + super(scope, list, staticType); this.list = list; } @@ -66,10 +67,10 @@ public String getClassName() { */ public Object get(String name, Scriptable start) { - if ("length".equals(name)) { + if (LENGTH_PROPERTY.equals(name)) { return list.size(); } else { - return Undefined.instance; + return super.get(name, start); } } @@ -78,7 +79,7 @@ public Object get(String name, Scriptable start) { */ public Object get(int index, Scriptable start) { - if (index < 0 || index >= list.size()) { + if (has(index, start) == false) { return Undefined.instance; } return list.get(index); @@ -89,10 +90,7 @@ public Object get(int index, Scriptable start) { */ public boolean has(String name, Scriptable start) { - if ("length".equals(name)) { - return true; - } - return false; + return super.has(name, start) || LENGTH_PROPERTY.equals(name); } /* (non-Javadoc) @@ -103,15 +101,6 @@ public boolean has(int index, Scriptable start) { return index >= 0 && index < list.size(); } - /* (non-Javadoc) - * @see org.mozilla.javascript.Scriptable#put(java.lang.String, org.mozilla.javascript.Scriptable, java.lang.Object) - */ - - @SuppressWarnings("unchecked") - public void put(String name, Scriptable start, Object value) { - // do nothing here... - } - /* (non-Javadoc) * @see org.mozilla.javascript.Scriptable#put(int, org.mozilla.javascript.Scriptable, java.lang.Object) */ @@ -124,14 +113,6 @@ public void put(int index, Scriptable start, Object value) { } } - /* (non-Javadoc) - * @see org.mozilla.javascript.Scriptable#delete(java.lang.String) - */ - - public void delete(String name) { - // nothing here - } - /* (non-Javadoc) * @see org.mozilla.javascript.Scriptable#delete(int) */ @@ -140,59 +121,20 @@ public void delete(int index) { list.remove(index); } - /* (non-Javadoc) - * @see org.mozilla.javascript.Scriptable#getPrototype() - */ - - public Scriptable getPrototype() { - return this.prototype; - } - - /* (non-Javadoc) - * @see org.mozilla.javascript.Scriptable#setPrototype(org.mozilla.javascript.Scriptable) - */ - - public void setPrototype(Scriptable prototype) { - this.prototype = prototype; - } - - /* (non-Javadoc) - * @see org.mozilla.javascript.Scriptable#getParentScope() - */ - - public Scriptable getParentScope() { - return this.parentScope; - } - - /* (non-Javadoc) - * @see org.mozilla.javascript.Scriptable#setParentScope(org.mozilla.javascript.Scriptable) - */ - - public void setParentScope(Scriptable parent) { - this.parentScope = parent; - } - /* (non-Javadoc) * @see org.mozilla.javascript.Scriptable#getIds() */ public Object[] getIds() { - int size = list.size(); - Object[] ids = new Object[size]; + final Object[] javaObjectIds = super.getIds(); + final int size = list.size(); + final Object[] ids = Arrays.copyOf(javaObjectIds, javaObjectIds.length + size); for (int i = 0; i < size; ++i) { - ids[i] = i; + ids[javaObjectIds.length + i] = i; } return ids; } - /* (non-Javadoc) - * @see org.mozilla.javascript.Scriptable#getDefaultValue(java.lang.Class) - */ - - public Object getDefaultValue(Class hint) { - return null; - } - /* (non-Javadoc) * @see org.mozilla.javascript.Scriptable#hasInstance(org.mozilla.javascript.Scriptable) */ diff --git a/src/main/java/org/elasticsearch/script/javascript/support/NativeMap.java b/src/main/java/org/elasticsearch/script/javascript/support/NativeMap.java index efdbac8..a43ecec 100644 --- a/src/main/java/org/elasticsearch/script/javascript/support/NativeMap.java +++ b/src/main/java/org/elasticsearch/script/javascript/support/NativeMap.java @@ -55,7 +55,7 @@ public static NativeMap wrap(Scriptable scope, Map map) { * @param scope * @param map */ - public NativeMap(Scriptable scope, Map map) { + private NativeMap(Scriptable scope, Map map) { this.parentScope = scope; this.map = map; } diff --git a/src/main/java/org/elasticsearch/script/javascript/support/ScriptValueConverter.java b/src/main/java/org/elasticsearch/script/javascript/support/ScriptValueConverter.java index 726d25d..7f9c390 100644 --- a/src/main/java/org/elasticsearch/script/javascript/support/ScriptValueConverter.java +++ b/src/main/java/org/elasticsearch/script/javascript/support/ScriptValueConverter.java @@ -156,7 +156,7 @@ public static Object wrapValue(Scriptable scope, Object value) { // convert array to a native JavaScript Array value = Context.getCurrentContext().newArray(scope, array); } else if (value instanceof Map) { - value = new NativeMap(scope, (Map) value); + value = NativeMap.wrap(scope, (Map) value); } // simple numbers, strings and booleans are wrapped automatically by Rhino diff --git a/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java b/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java index ec41b10..6c86d75 100644 --- a/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java +++ b/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptSearchTests.java @@ -43,6 +43,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.terms; import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse; +import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -285,4 +286,16 @@ public void testScriptScoresWithAgg() throws IOException { assertThat(((Terms) response.getAggregations().asMap().get("score_agg")).getBuckets().get(0).getKeyAsNumber().floatValue(), is(1f)); assertThat(((Terms) response.getAggregations().asMap().get("score_agg")).getBuckets().get(0).getDocCount(), is(1l)); } + + @Test + public void testUseListLengthInScripts() throws Exception { + createIndex("index"); + index("index", "testtype", "1", jsonBuilder().startObject().field("f", 42).endObject()); + ensureSearchable("index"); + refresh(); + SearchResponse response = client().prepareSearch().addScriptField("foobar", "js", "doc['f'].values.length", null).get(); + assertSearchResponse(response); + assertHitCount(response, 1); + assertThat((Integer) response.getHits().getAt(0).getFields().get("foobar").value(), equalTo(1)); + } } From 341c623f18fdba731db0bd6c7a799262a8246853 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Tue, 30 Dec 2014 21:58:35 -0500 Subject: [PATCH 20/31] Upgrade to Lucene 4.10.3 release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8b661ab..ac2929c 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ 1.5.0-SNAPSHOT 4.10.3 - 4.10.3-snapshot-1637985 + 4.10.3 1 true onerror From faf089eb5a4d31e8dcb0b0df8944d5a578750b5c Mon Sep 17 00:00:00 2001 From: David Pilato Date: Wed, 17 Dec 2014 09:49:39 +0100 Subject: [PATCH 21/31] Depend on elasticsearch-parent To simplify plugins maintenance and provide more value in the future, we are starting to build an `elasticsearch-parent` project. This commit is the first step for this plugin to depend on this new `pom` maven project. (cherry picked from commit 663be3b) --- .gitignore | 5 +- dev-tools/tests.policy | 54 +++++++++++++ pom.xml | 171 +++++------------------------------------ 3 files changed, 75 insertions(+), 155 deletions(-) create mode 100644 dev-tools/tests.policy diff --git a/.gitignore b/.gitignore index ee44051..9533848 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,8 @@ .DS_Store *.iml /.project -/.classpath /.settings -.local-execution-hints.log +/.classpath /plugin_tools +/.local-execution-hints.log +/.local-*-execution-hints.log diff --git a/dev-tools/tests.policy b/dev-tools/tests.policy new file mode 100644 index 0000000..6afb502 --- /dev/null +++ b/dev-tools/tests.policy @@ -0,0 +1,54 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Policy file to prevent tests from writing outside the test sandbox directory +// PLEASE NOTE: You may need to enable other permissions when new tests are added, +// everything not allowed here is forbidden! + +grant { + // permissions for file access, write access only to sandbox: + permission java.io.FilePermission "<>", "read,execute"; + permission java.io.FilePermission "${junit4.childvm.cwd}", "read,execute,write"; + permission java.io.FilePermission "${junit4.childvm.cwd}${/}-", "read,execute,write,delete"; + permission java.io.FilePermission "${junit4.tempDir}${/}*", "read,execute,write,delete"; + permission groovy.security.GroovyCodeSourcePermission "/groovy/script"; + + // Allow connecting to the internet anywhere + permission java.net.SocketPermission "*", "accept,listen,connect,resolve"; + + // Basic permissions needed for Lucene / Elasticsearch to work: + permission java.util.PropertyPermission "*", "read,write"; + permission java.lang.reflect.ReflectPermission "*"; + permission java.lang.RuntimePermission "*"; + + // These two *have* to be spelled out a separate + permission java.lang.management.ManagementPermission "control"; + permission java.lang.management.ManagementPermission "monitor"; + + permission java.net.NetPermission "*"; + permission java.util.logging.LoggingPermission "control"; + permission javax.management.MBeanPermission "*", "*"; + permission javax.management.MBeanServerPermission "*"; + permission javax.management.MBeanTrustPermission "*"; + + // Needed for some things in DNS caching in the JVM + permission java.security.SecurityPermission "getProperty.networkaddress.cache.ttl"; + permission java.security.SecurityPermission "getProperty.networkaddress.cache.negative.ttl"; + +}; diff --git a/pom.xml b/pom.xml index ac2929c..61669cd 100644 --- a/pom.xml +++ b/pom.xml @@ -3,6 +3,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + + + org.elasticsearch + elasticsearch-parent + 2.0.0-SNAPSHOT + + org.elasticsearch elasticsearch-lang-javascript 2.5.0-SNAPSHOT @@ -20,51 +27,30 @@ scm:git:git@github.com:elasticsearch/elasticsearch-lang-javascript.git - scm:git:git@github.com:elasticsearch/elasticsearch-lang-javascript.git - + scm:git:git@github.com:elasticsearch/elasticsearch-lang-javascript.git http://github.com/elasticsearch/elasticsearch-lang-javascript - - org.sonatype.oss - oss-parent - 7 - - - 1.5.0-SNAPSHOT - 4.10.3 - 4.10.3 - 1 - true - onerror - - INFO + - - - Lucene snapshots - https://download.elasticsearch.org/lucenesnapshots/1637985/ - - - sonatype - http://oss.sonatype.org/content/repositories/releases/ - - - + + org.hamcrest + hamcrest-all + + + com.carrotsearch.randomizedtesting + randomizedtesting-runner + org.apache.lucene lucene-test-framework - ${lucene.maven.version} - test - org.elasticsearch elasticsearch - ${elasticsearch.version} @@ -78,37 +64,13 @@ log4j log4j - 1.2.16 - runtime true org.elasticsearch elasticsearch - ${elasticsearch.version} test-jar - test - - - - org.hamcrest - hamcrest-core - 1.3.RC2 - test - - - - org.hamcrest - hamcrest-library - 1.3.RC2 - test - - - com.carrotsearch.randomizedtesting - randomizedtesting-runner - 2.1.10 - test @@ -126,120 +88,23 @@ org.apache.maven.plugins maven-compiler-plugin - 2.3.2 - - 1.7 - 1.7 - com.carrotsearch.randomizedtesting junit4-maven-plugin - 2.0.12 - - - tests - test - - junit4 - - - 20 - pipe,warn - true - - - - - - - - - ${tests.jvms} - - - - - - - **/*Tests.class - **/*Test.class - - - **/Abstract*.class - **/*StressTest.class - - - -Xmx512m - -XX:MaxDirectMemorySize=512m - -Des.logger.prefix= - - ${tests.shuffle} - ${tests.verbose} - ${tests.seed} - ${tests.failfast} - - - ${tests.iters} - ${tests.maxfailures} - ${tests.failfast} - ${tests.class} - ${tests.method} - ${tests.nightly} - ${tests.badapples} - ${tests.weekly} - ${tests.slow} - ${tests.awaitsfix} - ${tests.slow} - ${tests.timeoutSuite} - ${tests.showSuccess} - ${tests.integration} - ${tests.cluster_seed} - ${tests.client.ratio} - ${env.ES_TEST_LOCAL} - ${es.node.mode} - ${es.logger.level} - true - - - - org.apache.maven.plugins maven-surefire-plugin - 2.15 - - true - org.apache.maven.plugins maven-source-plugin - 2.1.2 - - - attach-sources - - jar - - - + org.apache.maven.plugins maven-assembly-plugin - 2.3 false ${project.build.directory}/releases/ From b8b4c607f1c7a7a8f52a9e3c258a558cc86b0de8 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Fri, 2 Jan 2015 18:39:08 +0100 Subject: [PATCH 22/31] Add sonatype snapshot repository (cherry picked from commit bbf1375) --- pom.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pom.xml b/pom.xml index 61669cd..d650a74 100644 --- a/pom.xml +++ b/pom.xml @@ -123,4 +123,12 @@ + + + + oss-snapshots + Sonatype OSS Snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + From 40a1ba9a171c5870cf9980bde6595669d1a7071a Mon Sep 17 00:00:00 2001 From: David Pilato Date: Fri, 2 Jan 2015 19:15:54 +0100 Subject: [PATCH 23/31] Depend on elasticsearch-parent To simplify plugins maintenance and provide more value in the future, we are starting to build an `elasticsearch-parent` project. This commit is the first step for this plugin to depend on this new `pom` maven project. (cherry picked from commit 663be3b) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d650a74..c970d5a 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.elasticsearch elasticsearch-parent - 2.0.0-SNAPSHOT + 1.5.0-SNAPSHOT org.elasticsearch From 879237b3b43e8dc271deeb4bb9c9023a7862e636 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Mon, 16 Mar 2015 13:45:07 -0700 Subject: [PATCH 24/31] Create `es-1.5` branch --- README.md | 2 +- pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f2b6c03..baf1e45 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ JavaScript lang Plugin for Elasticsearch The JavaScript language plugin allows to have `javascript` (or `js`) as the language of scripts to execute. -## Version 2.5.0-SNAPSHOT for Elasticsearch: 1.x +## Version 2.6.0-SNAPSHOT for Elasticsearch: 1.x If you are looking for another version documentation, please refer to the [compatibility matrix](http://github.com/elasticsearch/elasticsearch-lang-javascript#javascript-lang-plugin-for-elasticsearch). diff --git a/pom.xml b/pom.xml index c970d5a..e3d0783 100644 --- a/pom.xml +++ b/pom.xml @@ -7,12 +7,12 @@ org.elasticsearch elasticsearch-parent - 1.5.0-SNAPSHOT + 1.6.0-SNAPSHOT org.elasticsearch elasticsearch-lang-javascript - 2.5.0-SNAPSHOT + 2.6.0-SNAPSHOT jar Elasticsearch JavaScript language plugin The JavaScript language plugin allows to have javascript as the language of scripts to execute. From a11ebd4dc22c1339838d970b260f53010164fa71 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Sat, 28 Mar 2015 16:47:30 +0100 Subject: [PATCH 25/31] Move parent after artifact coordinates --- pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index e3d0783..fb5eb14 100644 --- a/pom.xml +++ b/pom.xml @@ -4,12 +4,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - org.elasticsearch - elasticsearch-parent - 1.6.0-SNAPSHOT - - org.elasticsearch elasticsearch-lang-javascript 2.6.0-SNAPSHOT @@ -31,6 +25,12 @@ http://github.com/elasticsearch/elasticsearch-lang-javascript + + org.elasticsearch + elasticsearch-parent + 1.6.0-SNAPSHOT + + From c59f9cef2fd2bd27cc60ba71109fa091feec26cd Mon Sep 17 00:00:00 2001 From: David Pilato Date: Sat, 28 Mar 2015 16:47:10 +0100 Subject: [PATCH 26/31] Move to elastic owner (cherry picked from commit 3d3ce33) --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index fb5eb14..817ffe5 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ jar Elasticsearch JavaScript language plugin The JavaScript language plugin allows to have javascript as the language of scripts to execute. - https://github.com/elasticsearch/elasticsearch-lang-javascript/ + https://github.com/elastic/elasticsearch-lang-javascript/ 2009 @@ -20,9 +20,9 @@ - scm:git:git@github.com:elasticsearch/elasticsearch-lang-javascript.git - scm:git:git@github.com:elasticsearch/elasticsearch-lang-javascript.git - http://github.com/elasticsearch/elasticsearch-lang-javascript + scm:git:git@github.com:elastic/elasticsearch-lang-javascript.git + scm:git:git@github.com:elastic/elasticsearch-lang-javascript.git + http://github.com/elastic/elasticsearch-lang-javascript From 6a3ac2586756f334a9829c2d745f6fe5672109be Mon Sep 17 00:00:00 2001 From: David Pilato Date: Thu, 11 Jun 2015 12:47:47 +0200 Subject: [PATCH 27/31] Update to elasticsearch 1.6.0 Closes #40. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 817ffe5..4bd8a0c 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ org.elasticsearch elasticsearch-parent - 1.6.0-SNAPSHOT + 1.6.0 From ab729df5b3cc474764c0ce5bba7a99d9363cd783 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Thu, 11 Jun 2015 12:54:09 +0200 Subject: [PATCH 28/31] Update to elasticsearch 1.7.0-SNAPSHOT --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4bd8a0c..5662197 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.elasticsearch elasticsearch-lang-javascript - 2.6.0-SNAPSHOT + 2.7.0-SNAPSHOT jar Elasticsearch JavaScript language plugin The JavaScript language plugin allows to have javascript as the language of scripts to execute. @@ -28,7 +28,7 @@ org.elasticsearch elasticsearch-parent - 1.6.0 + 1.7.0-SNAPSHOT From d1cd8a46efb87b747579dd3a15bafe0a70c513e4 Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Fri, 17 Jul 2015 16:43:43 +0200 Subject: [PATCH 29/31] Update to Elasticsearch 1.7.0 Closes #41 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5662197..85d33db 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ org.elasticsearch elasticsearch-parent - 1.7.0-SNAPSHOT + 1.7.0 From 5b23a58f45be4661cb2c51ebc038b7193c198dff Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Fri, 17 Jul 2015 16:49:38 +0200 Subject: [PATCH 30/31] prepare release elasticsearch-lang-javascript-2.7.0 --- README.md | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index baf1e45..c8821fb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ JavaScript lang Plugin for Elasticsearch The JavaScript language plugin allows to have `javascript` (or `js`) as the language of scripts to execute. -## Version 2.6.0-SNAPSHOT for Elasticsearch: 1.x +## Version 2.7.0 for Elasticsearch: 1.7 If you are looking for another version documentation, please refer to the [compatibility matrix](http://github.com/elasticsearch/elasticsearch-lang-javascript#javascript-lang-plugin-for-elasticsearch). diff --git a/pom.xml b/pom.xml index 85d33db..1560c12 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.elasticsearch elasticsearch-lang-javascript - 2.7.0-SNAPSHOT + 2.7.0 jar Elasticsearch JavaScript language plugin The JavaScript language plugin allows to have javascript as the language of scripts to execute. From 5dda86771f71cb7bf71ffc0d776f674ae9da9194 Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Fri, 17 Jul 2015 16:50:07 +0200 Subject: [PATCH 31/31] prepare for next development iteration --- README.md | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c8821fb..285487a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ JavaScript lang Plugin for Elasticsearch The JavaScript language plugin allows to have `javascript` (or `js`) as the language of scripts to execute. -## Version 2.7.0 for Elasticsearch: 1.7 +## Version 2.7.1-SNAPSHOT for Elasticsearch: 1.7 If you are looking for another version documentation, please refer to the [compatibility matrix](http://github.com/elasticsearch/elasticsearch-lang-javascript#javascript-lang-plugin-for-elasticsearch). diff --git a/pom.xml b/pom.xml index 1560c12..ead4896 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.elasticsearch elasticsearch-lang-javascript - 2.7.0 + 2.7.1-SNAPSHOT jar Elasticsearch JavaScript language plugin The JavaScript language plugin allows to have javascript as the language of scripts to execute.