1<?php
2
3declare(strict_types = 1);
4
5namespace Elasticsearch\Endpoints\Indices;
6
7use Elasticsearch\Endpoints\AbstractEndpoint;
8
9/**
10 * Class ForceMerge
11 *
12 * @category Elasticsearch
13 * @package  Elasticsearch\Endpoints\Indices
14 * @author   Zachary Tong <zach@elastic.co>
15 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache2
16 * @link     http://elastic.co
17 */
18class ForceMerge extends AbstractEndpoint
19{
20    public function getURI(): string
21    {
22        $index = $this->index ?? null;
23
24        if (isset($index)) {
25            return "/$index/_forcemerge";
26        }
27        return "/_forcemerge";
28    }
29
30    public function getParamWhitelist(): array
31    {
32        return [
33            'flush',
34            'ignore_unavailable',
35            'allow_no_indices',
36            'expand_wildcards',
37            'max_num_segments',
38            'only_expunge_deletes'
39        ];
40    }
41
42    public function getMethod(): string
43    {
44        return 'POST';
45    }
46}
47