70 Commits

Author SHA1 Message Date
Michael McCandless
a86d9e7908 Absorb ImmutableSettings into Settings 2015-05-26 09:34:33 -04:00
Robert Muir
fd035c556c remove logging properties 2015-05-22 09:32:19 -04:00
Robert Muir
65253a4bc8 switch to plugin pom 2015-05-21 22:55:42 -04:00
Robert Muir
79a8428aa2 remove duplicate test config 2015-05-21 16:52:05 -04:00
Robert Muir
2579af4fb5 engage forbidden apis 2015-05-21 10:37:06 -04:00
Robert Muir
1999fba0e8 remove unnecessary property 2015-05-13 23:36:19 -04:00
Robert Muir
8eeec50ace enable security manager in tests and upgrade to final jython 2.7.0
The previous rc version would try to execute /usr/bin/id...
2015-05-11 20:56:19 -04:00
Adrien Grand
410e0fa699 Fix compilation.
See https://github.com/elastic/elasticsearch/pull/10389 for background.
2015-04-09 14:39:04 +02:00
David Pilato
975feb1cbb update documentation with release 2.5.0 2015-03-28 14:34:03 +01:00
David Pilato
f7c0fbaee3 Update owner to elastic
(cherry picked from commit 283b92f)
(cherry picked from commit 49445b3)
2015-03-28 14:09:46 +01:00
David Pilato
655d8e4287 Move parent after artifact coordinates 2015-03-28 14:09:16 +01:00
Njal Karevoll
4e37122856 Update plugin description
Updates wording to (hopefully) better reflect what it does and removes reference to Javascript.
2015-03-26 19:09:04 +01:00
David Pilato
bc8073a40d create es-1.5 branch 2015-03-16 16:47:41 -07:00
David Pilato
42573fe6fc Fix version number for elasticsearch < 1.3.5
Related to #26
2015-02-12 10:01:13 +01:00
David Pilato
4cfb957f37 update documentation with release 2.3.1 2015-02-12 09:53:28 +01:00
David Pilato
fae56e39f9 Add sonatype snapshot repository 2015-01-02 18:42:56 +01:00
David Pilato
1ec8d69c6e 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.
2014-12-14 19:43:51 +01:00
David Pilato
ea41c9fc16 [Test] replace field.value() to field.values() for multivalued fields 2014-12-04 09:48:45 +01:00
Adrien Grand
480a862be1 Upgrade to Lucene 5.0.0-snapshot-1642891 2014-12-02 18:18:39 +01:00
Michael McCandless
99b08b0a5c Upgrade to Lucene 5.0.0-snapshot-1641343 2014-11-24 05:52:02 -05:00
Michael McCandless
2f4861905d Upgrade to Lucene 5.0.0-snapshot-1637347 2014-11-10 16:46:08 -05:00
Robert Muir
8cbdf5302f upgrade to lucene 5 snapshot 2014-11-05 17:18:37 -05:00
tlrx
c7a66cc8ab update documentation with release 2.4.1 2014-11-05 17:57:36 +01:00
tlrx
032dc51e9f [TESTS] Upgrade randomizedtesting-runner to 2.1.10
Closes #24
2014-11-03 12:09:24 +01:00
Michael McCandless
12805b56b7 Upgrade to Lucene 4.10.2 2014-10-30 05:55:59 -04:00
David Pilato
8afd16885a 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 #23.
2014-10-15 18:21:57 +02:00
David Pilato
336729021a update documentation with release 2.4.0 2014-10-07 13:45:37 +02:00
Britta Weber
dfeeee6e79 Multi-line or multi-statement Python scripts raise NullPointerException
Calling a multi-statement score using curl e.g. `a=22; _score*a` is not possible with the current lang-python, nor is it possible to write a script using semicolons or multiple lines. I can only get compound statements (e.g. list comprehensions with embedded if statements) to work, so I'm limited in the complexity of my scoring process.

I'm using ES 1.3.2 and latest lang-python:
```
$ ls -la /usr/share/elasticsearch/plugins/lang-python/
-rw-r--r-- 1 root root    10482 Aug 27 17:20 elasticsearch-lang-python-2.3.0.jar
-rw-r--r-- 1 root root 14340135 Aug 27 17:20 jython-standalone-2.5.3.jar
```

Here's a worked example:

```
# Delete existing data, add 2 simple records, fetch both results to stdout
curl -XDELETE "http://localhost:9200/test"
curl -XPUT "http://localhost:9200/test/doc/1" -d '{
  "num": 1.0
}'
curl -XPUT "http://localhost:9200/test/doc/2?refresh" -d '{
  "num": 2.0
}'
# show our records
curl -XGET 'http://localhost:9200/test/_search' -d '{
   "query" : { "match_all": {}}
}'
```

We'll run a simple query that uses `num` as a score modifier:
```doc["num"].value * _score```

If I create `/etc/elasticsearch/scripts/py1.py`:
```
doc["num"].value * _score
```

and wait for the script to reload (by monitoring the logs), I can call:
```
$ curl -XGET "http://localhost:9200/test/_search?pretty" -d'
{
  "query": {
    "function_score": {
      "script_score": {
        "script": "py1",
        "lang": "python"
      }
    }
  }
}'
```
and this will calculate the results.

The same can be achieved using an in-line call (ignoring `py1.py`):
```
curl -XGET "http://localhost:9200/test/_search?pretty" -d'
{
  "query": {
    "function_score": {
      "script_score": {
        "script": "doc[\"num\"].value * _score",
        "lang": "python"
      }
    }
  }
}'
```

However using more than 1 statement will fail. This example uses `;` to split 2 statements (this is legal in jython 2.5):
```
curl -XGET "http://localhost:9200/test/_search?pretty" -d'
{
  "query": {
    "function_score": {
      "script_score": {
        "script": "a=42; doc[\"num\"].value * _score",
        "lang": "python"
      }
    }
  }
}'

      "reason" : "QueryPhaseExecutionException[[test][3]: query[function score (ConstantScore(*:*),function=script[a=42; doc[\"num\"].value * _score], params [null])],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: NullPointerException; "
and the log message:
org.elasticsearch.search.query.QueryPhaseExecutionException: [test][3]: query[function score (ConstantScore(*:*),function=script[a=42; doc["num"].value * _score], params [null])],from[0],size[10]: Query Failed [Failed to execute main query]
	at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:162)
	at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:261)
	at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(SearchServiceTransportAction.java:206)
	at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(SearchServiceTransportAction.java:203)
	at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:517)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
```

Creating a `py2.py` in the scripts directory containing:
```
a=42; doc["num"].value * _score
```
and calling
```
$ curl -XGET "http://localhost:9200/test/_search?pretty" -d'
{
  "query": {
    "function_score": {
      "script_score": {
        "script": "py2",
        "lang": "python"
      }
    }
  }
}'
has the same error:
      "reason" : "QueryPhaseExecutionException[[test][3]: query[function score (ConstantScore(*:*),function=script[py2], params [null])],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: PyException; "
```

If a `py3.py` script is made with the same two statements split over two lines:
```
a=42
doc["num"].value * _score
```
then the same errors are thrown.

I'll note that if I experiment with equivalent groovy scripts then both the semicolon is allowed and multi-line scripts (in /scripts) are allowed.

Closes #19.

(cherry picked from commit 9fca562)
2014-10-07 13:25:08 +02:00
David Pilato
bc8c065977 Update to Jython 2.7-b3
It sounds like Jython 2.5.3 is leaking some threads.

Jython 2.5.4.rc1 has the same issue.

Jython 2.7-b3 fixes it.

Typical error when running tests:

```
ERROR   0.00s J2 | PythonScriptEngineTests (suite) <<<
   > Throwable #1: com.carrotsearch.randomizedtesting.ThreadLeakError: 1 thread leaked from SUITE scope at org.elasticsearch.script.python.PythonScriptEngineTests:
   >    1) Thread[id=12, name=org.python.google.common.base.internal.Finalizer, state=WAITING, group=TGRP-PythonScriptEngineTests]
   >         at java.lang.Object.wait(Native Method)
   >         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
   >         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
   >         at org.python.google.common.base.internal.Finalizer.run(Finalizer.java:127)
   >    at __randomizedtesting.SeedInfo.seed([7A5ECFD8D0474383]:0)
   > Throwable #2: com.carrotsearch.randomizedtesting.ThreadLeakError: There are still zombie threads that couldn't be terminated:
   >    1) Thread[id=12, name=org.python.google.common.base.internal.Finalizer, state=WAITING, group=TGRP-PythonScriptEngineTests]
   >         at java.lang.Object.wait(Native Method)
   >         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
   >         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
   >         at org.python.google.common.base.internal.Finalizer.run(Finalizer.java:127)
   >    at __randomizedtesting.SeedInfo.seed([7A5ECFD8D0474383]:0)
```

Closes #22.
2014-10-07 13:15:16 +02:00
Britta Weber
cd7756c283 Remove setNextScore in SearchScript
Due to a change in elasticsearch 1.4.0, we need to apply a similar patch here.

See elasticsearch/elasticsearch#6864
See elasticsearch/elasticsearch#7819

Closes #16.
Closes #21.
2014-10-07 13:14:08 +02:00
mikemccand
f7b4a4de9c Upgrade to Lucene 4.10.1 2014-09-28 17:57:50 -04:00
Michael McCandless
da5f0f785e Upgrade to Lucene 4.10.1 snapshot 2014-09-24 18:10:55 -04:00
David Pilato
4fd6012680 Create branch es-1.4 for elasticsearch 1.4.0 2014-09-15 10:42:31 +02:00
David Pilato
c1b4018f87 Docs: make the welcome page more obvious
Closes #17.
2014-09-09 00:05:22 +02:00
David Pilato
2bfac65f74 Update to Lucene 4.10.0
Closes #20.
2014-09-08 23:57:57 +02:00
David Pilato
d985f6b049 Update to elasticsearch 1.4.0
Related to #14.

(cherry picked from commit 964de0d)
2014-07-24 00:15:45 +02:00
David Pilato
870e8b8aa2 Update to elasticsearch 1.4.0
Closes #14.

(cherry picked from commit 8d677aa)
2014-07-23 23:53:55 +02:00
David Pilato
c58e49e84a Update to Lucene 4.9.0 / elasticsearch 1.3.0
Closes #15.
Related to #13.

(cherry picked from commit 8f077d6)
2014-07-23 23:52:50 +02:00
David Pilato
1e46301d83 [TEST] fix tests
Tests fail because we now disable automatic plugin loading from the classpat when running tests

(cherry picked from commit c5554ad)
2014-05-23 20:35:33 +02:00
David Pilato
9492736ab7 Update to elasticsearch 1.3.0
Closes #13.
(cherry picked from commit b9cff46)
2014-05-23 17:48:12 +02:00
David Pilato
b651570dde Update to elasticsearch 1.2.0
Closes #11.
(cherry picked from commit 8a87054)
2014-05-23 17:33:09 +02:00
David Pilato
2c18d35b59 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
2014-03-28 18:35:25 +01:00
David Pilato
d76bdb12da Disable java and maven version checking
And fix typo in email html
2014-03-19 22:42:50 +01:00
David Pilato
1b79c72e2d prepare for next development iteration 2014-03-07 17:41:37 +01:00
David Pilato
3303878d9a prepare release elasticsearch-lang-python-2.0.0 2014-03-07 17:37:59 +01:00
David Pilato
97b63f230f Add documentation
Closes #2.
2014-03-07 17:34:04 +01:00
David Pilato
491e2e3958 Update to elasticsearch 1.0.0
Closes #10.
2014-03-07 17:23:26 +01:00
David Pilato
7b89ac3458 Add plugin version in es-plugin.properties
With https://github.com/elasticsearch/elasticsearch/issues/2784, we can now add plugin version in `es-plugin.properties` file.

It will only be used with elasticsearch 1.0.0 and upper. No need to push it in 1.x branch.

Closes #9.
2014-03-07 17:19:30 +01:00
David Pilato
79ac03e9c5 Add plugin release semi-automatic script
Closes #8.
2014-03-07 17:17:47 +01:00
David Pilato
b7511a18ca prepare for next development iteration 2014-01-15 19:54:57 +01:00