diff --git a/README.md b/README.md
index 7050f1c698a..46296fa4850 100644
--- a/README.md
+++ b/README.md
@@ -8,9 +8,9 @@ In order to install the plugin, simply run: `bin/plugin -install elasticsearch/e
---------------------------------------
| Python Plugin | ElasticSearch |
---------------------------------------
- | master | 0.19 -> master |
+ | master | 0.21 -> master |
---------------------------------------
- | 1.1.0 | 0.19 -> master |
+ | 1.1.0 | 0.19 -> 0.20 |
---------------------------------------
| 1.0.0 | 0.18 |
---------------------------------------
diff --git a/pom.xml b/pom.xml
index 267f6aa1a99..32e856afe9b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
- 0.19.0
+ 0.21.0.Beta1-SNAPSHOT
@@ -141,4 +141,4 @@
-
\ No newline at end of file
+
diff --git a/src/main/java/org/elasticsearch/script/python/PythonScriptEngineService.java b/src/main/java/org/elasticsearch/script/python/PythonScriptEngineService.java
index 84a00b3aa04..877c6f50c2a 100644
--- a/src/main/java/org/elasticsearch/script/python/PythonScriptEngineService.java
+++ b/src/main/java/org/elasticsearch/script/python/PythonScriptEngineService.java
@@ -19,7 +19,7 @@
package org.elasticsearch.script.python;
-import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.search.Scorer;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.component.AbstractComponent;
@@ -161,8 +161,8 @@ public class PythonScriptEngineService extends AbstractComponent implements Scri
}
@Override
- public void setNextReader(IndexReader reader) {
- lookup.setNextReader(reader);
+ public void setNextReader(AtomicReaderContext context) {
+ lookup.setNextReader(context);
}
@Override
diff --git a/src/test/java/org/elasticsearch/script/python/PythonScriptSearchTests.java b/src/test/java/org/elasticsearch/script/python/PythonScriptSearchTests.java
index 0f5ef643dfc..91038aa94b3 100644
--- a/src/test/java/org/elasticsearch/script/python/PythonScriptSearchTests.java
+++ b/src/test/java/org/elasticsearch/script/python/PythonScriptSearchTests.java
@@ -96,11 +96,11 @@ public class PythonScriptSearchTests {
.addScriptField("sNum1", "python", "doc['num1'].value", null)
.execute().actionGet();
- assertThat(response.hits().totalHits(), equalTo(2l));
- assertThat(response.hits().getAt(0).id(), equalTo("2"));
- assertThat((Double) response.hits().getAt(0).fields().get("sNum1").values().get(0), equalTo(2.0));
- assertThat(response.hits().getAt(1).id(), equalTo("3"));
- assertThat((Double) response.hits().getAt(1).fields().get("sNum1").values().get(0), equalTo(3.0));
+ assertThat(response.getHits().totalHits(), equalTo(2l));
+ assertThat(response.getHits().getAt(0).id(), equalTo("2"));
+ assertThat((Double) response.getHits().getAt(0).fields().get("sNum1").values().get(0), equalTo(2.0));
+ assertThat(response.getHits().getAt(1).id(), equalTo("3"));
+ assertThat((Double) response.getHits().getAt(1).fields().get("sNum1").values().get(0), equalTo(3.0));
logger.info("running doc['num1'].value > param1");
response = client.prepareSearch()
@@ -109,9 +109,9 @@ public class PythonScriptSearchTests {
.addScriptField("sNum1", "python", "doc['num1'].value", null)
.execute().actionGet();
- assertThat(response.hits().totalHits(), equalTo(1l));
- assertThat(response.hits().getAt(0).id(), equalTo("3"));
- assertThat((Double) response.hits().getAt(0).fields().get("sNum1").values().get(0), equalTo(3.0));
+ assertThat(response.getHits().totalHits(), equalTo(1l));
+ assertThat(response.getHits().getAt(0).id(), equalTo("3"));
+ assertThat((Double) response.getHits().getAt(0).fields().get("sNum1").values().get(0), equalTo(3.0));
logger.info("running doc['num1'].value > param1");
response = client.prepareSearch()
@@ -120,13 +120,13 @@ public class PythonScriptSearchTests {
.addScriptField("sNum1", "python", "doc['num1'].value", null)
.execute().actionGet();
- assertThat(response.hits().totalHits(), equalTo(3l));
- assertThat(response.hits().getAt(0).id(), equalTo("1"));
- assertThat((Double) response.hits().getAt(0).fields().get("sNum1").values().get(0), equalTo(1.0));
- assertThat(response.hits().getAt(1).id(), equalTo("2"));
- assertThat((Double) response.hits().getAt(1).fields().get("sNum1").values().get(0), equalTo(2.0));
- assertThat(response.hits().getAt(2).id(), equalTo("3"));
- assertThat((Double) response.hits().getAt(2).fields().get("sNum1").values().get(0), equalTo(3.0));
+ assertThat(response.getHits().totalHits(), equalTo(3l));
+ assertThat(response.getHits().getAt(0).id(), equalTo("1"));
+ assertThat((Double) response.getHits().getAt(0).fields().get("sNum1").values().get(0), equalTo(1.0));
+ assertThat(response.getHits().getAt(1).id(), equalTo("2"));
+ assertThat((Double) response.getHits().getAt(1).fields().get("sNum1").values().get(0), equalTo(2.0));
+ assertThat(response.getHits().getAt(2).id(), equalTo("3"));
+ assertThat((Double) response.getHits().getAt(2).fields().get("sNum1").values().get(0), equalTo(3.0));
}
@Test
@@ -149,21 +149,21 @@ public class PythonScriptSearchTests {
.addScriptField("s_obj2_arr2", "python", "_source['obj2']['arr2']", null)
.execute().actionGet();
- Map sObj1 = (Map) response.hits().getAt(0).field("_source.obj1").value();
+ Map sObj1 = (Map) response.getHits().getAt(0).field("_source.obj1").value();
assertThat(sObj1.get("test").toString(), equalTo("something"));
- assertThat(response.hits().getAt(0).field("s_obj1_test").value().toString(), equalTo("something"));
+ assertThat(response.getHits().getAt(0).field("s_obj1_test").value().toString(), equalTo("something"));
- sObj1 = (Map) response.hits().getAt(0).field("s_obj1").value();
+ sObj1 = (Map) response.getHits().getAt(0).field("s_obj1").value();
assertThat(sObj1.get("test").toString(), equalTo("something"));
- assertThat(response.hits().getAt(0).field("s_obj1_test").value().toString(), equalTo("something"));
+ assertThat(response.getHits().getAt(0).field("s_obj1_test").value().toString(), equalTo("something"));
- Map sObj2 = (Map) response.hits().getAt(0).field("s_obj2").value();
+ Map sObj2 = (Map) response.getHits().getAt(0).field("s_obj2").value();
List sObj2Arr2 = (List) sObj2.get("arr2");
assertThat(sObj2Arr2.size(), equalTo(2));
assertThat(sObj2Arr2.get(0).toString(), equalTo("arr_value1"));
assertThat(sObj2Arr2.get(1).toString(), equalTo("arr_value2"));
- sObj2Arr2 = (List) response.hits().getAt(0).field("s_obj2_arr2").value();
+ sObj2Arr2 = (List) response.getHits().getAt(0).field("s_obj2_arr2").value();
assertThat(sObj2Arr2.size(), equalTo(2));
assertThat(sObj2Arr2.get(0).toString(), equalTo("arr_value1"));
assertThat(sObj2Arr2.get(1).toString(), equalTo("arr_value2"));
@@ -201,13 +201,13 @@ public class PythonScriptSearchTests {
.source(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("doc['num1'].value").lang("python")))
).actionGet();
- assertThat("Failures " + Arrays.toString(response.shardFailures()), response.shardFailures().length, equalTo(0));
+ assertThat("Failures " + Arrays.toString(response.getShardFailures()), response.getShardFailures().length, equalTo(0));
- assertThat(response.hits().totalHits(), equalTo(2l));
- logger.info("Hit[0] {} Explanation {}", response.hits().getAt(0).id(), response.hits().getAt(0).explanation());
- logger.info("Hit[1] {} Explanation {}", response.hits().getAt(1).id(), response.hits().getAt(1).explanation());
- assertThat(response.hits().getAt(0).id(), equalTo("2"));
- assertThat(response.hits().getAt(1).id(), equalTo("1"));
+ assertThat(response.getHits().totalHits(), equalTo(2l));
+ 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());
+ assertThat(response.getHits().getAt(0).id(), equalTo("2"));
+ assertThat(response.getHits().getAt(1).id(), equalTo("1"));
logger.info("running -doc['num1'].value");
response = client.search(searchRequest()
@@ -215,13 +215,13 @@ public class PythonScriptSearchTests {
.source(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("-doc['num1'].value").lang("python")))
).actionGet();
- assertThat("Failures " + Arrays.toString(response.shardFailures()), response.shardFailures().length, equalTo(0));
+ assertThat("Failures " + Arrays.toString(response.getShardFailures()), response.getShardFailures().length, equalTo(0));
- assertThat(response.hits().totalHits(), equalTo(2l));
- logger.info("Hit[0] {} Explanation {}", response.hits().getAt(0).id(), response.hits().getAt(0).explanation());
- logger.info("Hit[1] {} Explanation {}", response.hits().getAt(1).id(), response.hits().getAt(1).explanation());
- assertThat(response.hits().getAt(0).id(), equalTo("1"));
- assertThat(response.hits().getAt(1).id(), equalTo("2"));
+ assertThat(response.getHits().totalHits(), equalTo(2l));
+ 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());
+ assertThat(response.getHits().getAt(0).id(), equalTo("1"));
+ assertThat(response.getHits().getAt(1).id(), equalTo("2"));
logger.info("running doc['num1'].value * _score");
@@ -230,13 +230,13 @@ public class PythonScriptSearchTests {
.source(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("doc['num1'].value * _score").lang("python")))
).actionGet();
- assertThat("Failures " + Arrays.toString(response.shardFailures()), response.shardFailures().length, equalTo(0));
+ assertThat("Failures " + Arrays.toString(response.getShardFailures()), response.getShardFailures().length, equalTo(0));
- assertThat(response.hits().totalHits(), equalTo(2l));
- logger.info("Hit[0] {} Explanation {}", response.hits().getAt(0).id(), response.hits().getAt(0).explanation());
- logger.info("Hit[1] {} Explanation {}", response.hits().getAt(1).id(), response.hits().getAt(1).explanation());
- assertThat(response.hits().getAt(0).id(), equalTo("2"));
- assertThat(response.hits().getAt(1).id(), equalTo("1"));
+ assertThat(response.getHits().totalHits(), equalTo(2l));
+ 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());
+ assertThat(response.getHits().getAt(0).id(), equalTo("2"));
+ assertThat(response.getHits().getAt(1).id(), equalTo("1"));
logger.info("running param1 * param2 * _score");
response = client.search(searchRequest()
@@ -244,10 +244,10 @@ public class PythonScriptSearchTests {
.source(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("param1 * param2 * _score").param("param1", 2).param("param2", 2).lang("python")))
).actionGet();
- assertThat("Failures " + Arrays.toString(response.shardFailures()), response.shardFailures().length, equalTo(0));
+ assertThat("Failures " + Arrays.toString(response.getShardFailures()), response.getShardFailures().length, equalTo(0));
- assertThat(response.hits().totalHits(), equalTo(2l));
- logger.info("Hit[0] {} Explanation {}", response.hits().getAt(0).id(), response.hits().getAt(0).explanation());
- logger.info("Hit[1] {} Explanation {}", response.hits().getAt(1).id(), response.hits().getAt(1).explanation());
+ assertThat(response.getHits().totalHits(), equalTo(2l));
+ 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());
}
}