Skip to content

Commit a3197e0

Browse files
committed
Simplified delete() by having a dedicated deleteByQuery() just like the real http api has anyways
1 parent 67a71a4 commit a3197e0

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

ElasticSearchClient.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,16 @@ public function search($query) {
9090
* if not wipe the entire index
9191
*/
9292
public function delete($id=false) {
93-
if (is_array($id))
94-
return $this->transport->deleteByQuery($id);
9593
return $this->transport->delete($id);
9694
}
95+
96+
/**
97+
* Flush this index/type combination
98+
*
99+
* @return array
100+
* @param mixed $query Text or array based query to delete everything that matches
101+
*/
102+
public function deleteByQuery($query) {
103+
return $this->transport->deleteByQuery($query);
104+
}
97105
}

tests/HTTPTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testDeleteByQuery() {
3636

3737
sleep(1); // To make sure the documents will be ready
3838

39-
$del = $this->search->delete(array(
39+
$del = $this->search->deleteByQuery(array(
4040
'term' => array('title' => 'cool')
4141
));
4242

0 commit comments

Comments
 (0)