Skip to content

Commit

Permalink
scripting cleanup, removed ScriptFile
Browse files Browse the repository at this point in the history
  • Loading branch information
p365labs committed Aug 30, 2017
1 parent ac70945 commit fb6f999
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 269 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ All notable changes to this project will be documented in this file based on the
- 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)
- 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)
- 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)

- Removed file scripts [#24627](https://github.com/elastic/elasticsearch/pull/24627) [#1364](https://github.com/ruflin/Elastica/pull/1364)
- Removed [groovy script](https://github.com/elastic/elasticsearch/pull/21607) [#1364](https://github.com/ruflin/Elastica/pull/1364)
- Removed [native script](https://github.com/elastic/elasticsearch/pull/24726) [#1364](https://github.com/ruflin/Elastica/pull/1364)
- Removed old / removed script language support : javascript, python, mvel [#1364](https://github.com/ruflin/Elastica/pull/1364)

### Bugfixes
- 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)
- Scroll no longer does an extra iteration both on an empty result and on searches where the last page has a significantly smaller number of results than the pages before it.
Expand Down
16 changes: 2 additions & 14 deletions lib/Elastica/Script/AbstractScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
*/
abstract class AbstractScript extends AbstractUpdateAction
{
const LANG_MVEL = 'mvel';
const LANG_JS = 'js';
const LANG_GROOVY = 'groovy';
const LANG_PYTHON = 'python';
const LANG_NATIVE = 'native';
const LANG_MOUSTACHE = 'moustache';
const LANG_EXPRESSION = 'expression';
const LANG_PAINLESS = 'painless';

Expand All @@ -37,7 +33,7 @@ abstract class AbstractScript extends AbstractUpdateAction
*
* @throws InvalidException
*
* @return Script|ScriptFile|ScriptId
* @return Script|ScriptId
*/
public static function create($data)
{
Expand Down Expand Up @@ -75,14 +71,6 @@ private static function _createFromArray(array $data)
);
}

if (isset($data['script']['file'])) {
return new ScriptFile(
$data['script']['file'],
$params,
$lang
);
}

if (isset($data['script']['id'])) {
return new ScriptId(
$data['script']['id'],
Expand Down
60 changes: 0 additions & 60 deletions lib/Elastica/Script/ScriptFile.php

This file was deleted.

1 change: 1 addition & 0 deletions test/Elastica/Index/SettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ public function testGetDefaultNumberOfShards()
$client = $this->_getClient();
$index = $client->getIndex($indexName);
$index->create([], true);
$index->refresh();

$settings = $index->getSettings();

Expand Down
190 changes: 0 additions & 190 deletions test/Elastica/Script/ScriptFileTest.php

This file was deleted.

4 changes: 2 additions & 2 deletions test/Elastica/Script/ScriptIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public function testSetLang()
{
$script = new ScriptId(self::SCRIPT_ID, [], ScriptId::LANG_PAINLESS);

$this->assertSame($script, $script->setLang(ScriptId::LANG_GROOVY));
$this->assertEquals(ScriptId::LANG_GROOVY, $script->getLang());
$this->assertSame($script, $script->setLang(ScriptId::LANG_PAINLESS));
$this->assertEquals(ScriptId::LANG_PAINLESS, $script->getLang());
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/Elastica/Script/ScriptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ public function testSetLang()
{
$script = new Script(self::SCRIPT, [], Script::LANG_PAINLESS);

$this->assertSame($script, $script->setLang(Script::LANG_GROOVY));
$this->assertEquals(Script::LANG_GROOVY, $script->getLang());
$this->assertSame($script, $script->setLang(Script::LANG_PAINLESS));
$this->assertEquals(Script::LANG_PAINLESS, $script->getLang());
}

/**
Expand Down

0 comments on commit fb6f999

Please sign in to comment.