Skip to content

Commit 97e4125

Browse files
author
Kapitanov Andrey
committed
V8 Cat Indices
1 parent 6062a66 commit 97e4125

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

src/Concerns/InteractsWithIndex.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@ public function catIndices(string $indexName, ?array $getFields = null): array
7171
return $this->resolveClient()->catIndices($indexName, $getFields);
7272
}
7373

74-
public function indicesInfo(array $columns = ['i'], array $sort = [], ?string $health = null): array
75-
{
76-
return $this->resolveClient()->indicesInfo($columns, $sort, $health);
74+
public function indicesInfo(
75+
?array $indices = [],
76+
array $columns = ['i'],
77+
array $sort = [],
78+
?string $health = null
79+
): array {
80+
return $this->resolveClient()->indicesInfo($indices, $columns, $sort, $health);
7781
}
7882

7983
public function indicesDelete(string $index): array

src/ElasticClient.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,16 @@ public function catIndices(string $indexName, ?array $getFields = null): array
102102
return $results;
103103
}
104104

105-
public function indicesInfo(array $columns = ['i'], array $sort = [], ?string $health = null): array
106-
{
105+
public function indicesInfo(
106+
?array $indices = [],
107+
array $columns = ['i'],
108+
array $sort = [],
109+
?string $health = null
110+
): array {
107111
$params = ['format' => 'json', 'h' => 'i'];
112+
if ($indices) {
113+
$params['index'] = implode(',', $indices);
114+
}
108115
if ($health) {
109116
$params['h'] = $health;
110117
}
@@ -116,9 +123,9 @@ public function indicesInfo(array $columns = ['i'], array $sort = [], ?string $h
116123
}
117124

118125
return $this->client
119-
->cat()
120-
->indices($params)
121-
->asArray();
126+
->cat()
127+
->indices($params)
128+
->asArray();
122129
}
123130

124131
public function indicesDelete(string $indexName): array

0 commit comments

Comments
 (0)