Skip to content

Commit

Permalink
Compatibility with Elasticsearch 7.14
Browse files Browse the repository at this point in the history
- Removed empty body from requests.
- Hide indices reserved for system operations.
  • Loading branch information
peterpp committed Sep 18, 2021
1 parent 5f2946a commit 1e51869
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions adminer/drivers/elastic7.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Min_DB {
* @param string
* @return mixed
*/
function rootQuery($path, $content = array(), $method = 'GET') {
function rootQuery($path, $content = null, $method = 'GET') {
@ini_set('track_errors', 1); // @ - may be disabled

$file = @file_get_contents("$this->_url/" . ltrim($path, '/'), false, stream_context_create(
Expand Down Expand Up @@ -69,7 +69,7 @@ function rootQuery($path, $content = array(), $method = 'GET') {
* @param string
* @return mixed
*/
function query($path, $content = array(), $method = 'GET') {
function query($path, $content = null, $method = 'GET') {
// Support for global search through all tables
if ($path[0] == "S" && preg_match('/SELECT 1 FROM ([^ ]+) WHERE (.+) LIMIT ([0-9]+)/', $path, $matches)) {
global $driver;
Expand Down Expand Up @@ -385,6 +385,10 @@ function table_status($name = "", $fast = false) {

ksort($stats["indices"]);
foreach ($stats["indices"] as $name => $index) {
if ($name[0] == ".") {
continue;
}

$result[$name] = format_index_status($name, $index);

if (!empty($aliases[$name]["aliases"])) {
Expand Down Expand Up @@ -539,7 +543,7 @@ function create_database($db) {
function drop_databases($databases) {
global $connection;

return $connection->rootQuery(urlencode(implode(',', $databases)), array(), 'DELETE');
return $connection->rootQuery(urlencode(implode(',', $databases)), null, 'DELETE');
}

/** Alter type
Expand Down Expand Up @@ -574,7 +578,7 @@ function drop_tables($tables) {

$return = true;
foreach ($tables as $table) { //! convert to bulk api
$return = $return && $connection->query(urlencode($table), array(), 'DELETE');
$return = $return && $connection->query(urlencode($table), null, 'DELETE');
}

return $return;
Expand Down

0 comments on commit 1e51869

Please sign in to comment.