Skip to content

Commit 95689cd

Browse files
committed
Fixing script get and delete by removing lang from endpoint url
1 parent 64935da commit 95689cd

File tree

3 files changed

+4
-58
lines changed

3 files changed

+4
-58
lines changed

src/Elasticsearch/Client.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,15 +1213,13 @@ public function updateByQuery($params = array())
12131213
public function getScript($params)
12141214
{
12151215
$id = $this->extractArgument($params, 'id');
1216-
$lang = $this->extractArgument($params, 'lang');
12171216

12181217
/** @var callback $endpointBuilder */
12191218
$endpointBuilder = $this->endpoints;
12201219

12211220
/** @var \Elasticsearch\Endpoints\Script\Get $endpoint */
12221221
$endpoint = $endpointBuilder('Script\Get');
1223-
$endpoint->setID($id)
1224-
->setLang($lang);
1222+
$endpoint->setID($id);
12251223
$endpoint->setParams($params);
12261224

12271225
return $this->performRequest($endpoint);
@@ -1238,15 +1236,13 @@ public function getScript($params)
12381236
public function deleteScript($params)
12391237
{
12401238
$id = $this->extractArgument($params, 'id');
1241-
$lang = $this->extractArgument($params, 'lang');
12421239

12431240
/** @var callback $endpointBuilder */
12441241
$endpointBuilder = $this->endpoints;
12451242

12461243
/** @var \Elasticsearch\Endpoints\Script\Delete $endpoint */
12471244
$endpoint = $endpointBuilder('Script\Delete');
1248-
$endpoint->setID($id)
1249-
->setLang($lang);
1245+
$endpoint->setID($id);
12501246
$endpoint->setParams($params);
12511247

12521248
return $this->performRequest($endpoint);

src/Elasticsearch/Endpoints/Script/Delete.php

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,44 +18,19 @@
1818
*/
1919
class Delete extends AbstractEndpoint
2020
{
21-
/** @var string */
22-
private $lang;
23-
24-
/**
25-
* @param string $lang
26-
*
27-
* @return $this
28-
*/
29-
public function setLang($lang)
30-
{
31-
if (isset($lang) !== true) {
32-
return $this;
33-
}
34-
35-
$this->lang = $lang;
36-
37-
return $this;
38-
}
39-
4021
/**
4122
* @throws \Elasticsearch\Common\Exceptions\RuntimeException
4223
* @return string
4324
*/
4425
public function getURI()
4526
{
46-
if (isset($this->lang) !== true) {
47-
throw new Exceptions\RuntimeException(
48-
'lang is required for Put'
49-
);
50-
}
5127
if (isset($this->id) !== true) {
5228
throw new Exceptions\RuntimeException(
5329
'id is required for put'
5430
);
5531
}
5632
$id = $this->id;
57-
$lang = $this->lang;
58-
$uri = "/_scripts/$lang/$id";
33+
$uri = "/_scripts/$id";
5934

6035
return $uri;
6136
}

src/Elasticsearch/Endpoints/Script/Get.php

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,44 +18,19 @@
1818
*/
1919
class Get extends AbstractEndpoint
2020
{
21-
/** @var string */
22-
private $lang;
23-
24-
/**
25-
* @param string $lang
26-
*
27-
* @return $this
28-
*/
29-
public function setLang($lang)
30-
{
31-
if (isset($lang) !== true) {
32-
return $this;
33-
}
34-
35-
$this->lang = $lang;
36-
37-
return $this;
38-
}
39-
4021
/**
4122
* @throws \Elasticsearch\Common\Exceptions\RuntimeException
4223
* @return string
4324
*/
4425
public function getURI()
4526
{
46-
if (isset($this->lang) !== true) {
47-
throw new Exceptions\RuntimeException(
48-
'lang is required for Put'
49-
);
50-
}
5127
if (isset($this->id) !== true) {
5228
throw new Exceptions\RuntimeException(
5329
'id is required for put'
5430
);
5531
}
5632
$id = $this->id;
57-
$lang = $this->lang;
58-
$uri = "/_scripts/$lang/$id";
33+
$uri = "/_scripts/$id";
5934

6035
return $uri;
6136
}

0 commit comments

Comments
 (0)