1// docs/reindex.asciidoc:767
2
3[source, php]
4----
5$params = [
6    'body' => [
7        'source' => [
8            'index' => 'metricbeat-*',
9        ],
10        'dest' => [
11            'index' => 'metricbeat',
12        ],
13        'script' => [
14            'lang' => 'painless',
15            'source' => 'ctx._index = \'metricbeat-\' + (ctx._index.substring(\'metricbeat-\'.length(), ctx._index.length())) + \'-1\'',
16        ],
17    ],
18];
19$response = $client->reindex($params);
20----
21