Skip to content

Commit 0be4f71

Browse files
committed
scripting cleanup, removed ScriptFile
1 parent f28072d commit 0be4f71

File tree

7 files changed

+11
-268
lines changed

7 files changed

+11
-268
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ All notable changes to this project will be documented in this file based on the
1515
- In QueryString is not allowed to use fields parameters in conjunction with default_field parameter. This is not well documented, it's possibile to understand from [Elasticsearch tests : QueryStringQueryBuilderTests.java](https://github.com/elastic/elasticsearch/blob/6.0/core/src/test/java/org/elasticsearch/index/query/QueryStringQueryBuilderTests.java#L917) [#1352](https://github.com/ruflin/Elastica/pull/1352)
1616
- Index mapping field of type [*'string'*](https://www.elastic.co/guide/en/elasticsearch/reference/5.5/string.html) has been removed from Elasticsearch 6.0 codebase [#1353](https://github.com/ruflin/Elastica/pull/1353)
1717
- The [created and found](https://github.com/elastic/elasticsearch/pull/25516) fields in index and delete responses became obsolete after the introduction of the result field in index, update and delete responses [#1354](https://github.com/ruflin/Elastica/pull/1354)
18+
- Removed file scripts [#24627](https://github.com/elastic/elasticsearch/pull/24627) [#1364](https://github.com/ruflin/Elastica/pull/1364)
19+
- Removed [groovy script](https://github.com/elastic/elasticsearch/pull/21607) [#1364](https://github.com/ruflin/Elastica/pull/1364)
20+
- Removed [native script](https://github.com/elastic/elasticsearch/pull/24726) [#1364](https://github.com/ruflin/Elastica/pull/1364)
21+
- Removed old / removed script language support : javascript, python, mvel [#1364](https://github.com/ruflin/Elastica/pull/1364)
1822

1923
### Bugfixes
2024
- Enforce [Content-Type requirement on the layer Rest](https://github.com/elastic/elasticsearch/pull/23146), a [PR on Elastica #1301](https://github.com/ruflin/Elastica/issues/1301) solved it (it has been implemented only in the HTTP Transport), but it was not implemented in the Guzzle Transport. [#1349](https://github.com/ruflin/Elastica/pull/1349)

lib/Elastica/Script/AbstractScript.php

+2-14
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717
*/
1818
abstract class AbstractScript extends AbstractUpdateAction
1919
{
20-
const LANG_MVEL = 'mvel';
21-
const LANG_JS = 'js';
22-
const LANG_GROOVY = 'groovy';
23-
const LANG_PYTHON = 'python';
24-
const LANG_NATIVE = 'native';
20+
const LANG_MOUSTACHE = 'moustache';
2521
const LANG_EXPRESSION = 'expression';
2622
const LANG_PAINLESS = 'painless';
2723

@@ -37,7 +33,7 @@ abstract class AbstractScript extends AbstractUpdateAction
3733
*
3834
* @throws InvalidException
3935
*
40-
* @return Script|ScriptFile|ScriptId
36+
* @return Script|ScriptId
4137
*/
4238
public static function create($data)
4339
{
@@ -75,14 +71,6 @@ private static function _createFromArray(array $data)
7571
);
7672
}
7773

78-
if (isset($data['script']['file'])) {
79-
return new ScriptFile(
80-
$data['script']['file'],
81-
$params,
82-
$lang
83-
);
84-
}
85-
8674
if (isset($data['script']['id'])) {
8775
return new ScriptId(
8876
$data['script']['id'],

lib/Elastica/Script/ScriptFile.php

-60
This file was deleted.

test/Elastica/Index/SettingsTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public function testGetDefaultNumberOfShards()
151151
{
152152
$index = $this->_createIndex();
153153
$index->create([], true);
154+
$index->refresh();
154155

155156
$settings = $index->getSettings();
156157

test/Elastica/Script/ScriptFileTest.php

-190
This file was deleted.

test/Elastica/Script/ScriptIdTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ public function testSetLang()
143143
{
144144
$script = new ScriptId(self::SCRIPT_ID, [], ScriptId::LANG_PAINLESS);
145145

146-
$this->assertSame($script, $script->setLang(ScriptId::LANG_GROOVY));
147-
$this->assertEquals(ScriptId::LANG_GROOVY, $script->getLang());
146+
$this->assertSame($script, $script->setLang(ScriptId::LANG_PAINLESS));
147+
$this->assertEquals(ScriptId::LANG_PAINLESS, $script->getLang());
148148
}
149149

150150
/**

test/Elastica/Script/ScriptTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ public function testSetLang()
142142
{
143143
$script = new Script(self::SCRIPT, [], Script::LANG_PAINLESS);
144144

145-
$this->assertSame($script, $script->setLang(Script::LANG_GROOVY));
146-
$this->assertEquals(Script::LANG_GROOVY, $script->getLang());
145+
$this->assertSame($script, $script->setLang(Script::LANG_PAINLESS));
146+
$this->assertEquals(Script::LANG_PAINLESS, $script->getLang());
147147
}
148148

149149
/**

0 commit comments

Comments
 (0)