1<?php
2
3declare(strict_types = 1);
4
5namespace Elasticsearch\Endpoints;
6
7/**
8 * Class MTermVectors
9 *
10 * @category Elasticsearch
11 * @package  Elasticsearch\Endpoints
12 * @author   Zachary Tong <zach@elastic.co>
13 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache2
14 * @link     http://elastic.co
15 */
16class MTermVectors extends AbstractEndpoint
17{
18    public function setBody($body): MTermVectors
19    {
20        if (isset($body) !== true) {
21            return $this;
22        }
23
24        $this->body = $body;
25
26        return $this;
27    }
28
29    public function getURI(): string
30    {
31        $type = $this->type ?? null;
32        $index = $this->index ?? null;
33
34        if (isset($type) && isset($index)) {
35            return "/$index/$type/_mtermvectors";
36        }
37        if (isset($index)) {
38            return "/$index/_mtermvectors";
39        }
40        return "/_mtermvectors";
41    }
42
43    public function getParamWhitelist(): array
44    {
45        return [
46            'ids',
47            'term_statistics',
48            'field_statistics',
49            'fields',
50            'offsets',
51            'positions',
52            'payloads',
53            'preference',
54            'routing',
55            'parent',
56            'realtime',
57            'version',
58            'version_type'
59        ];
60    }
61
62    public function getMethod(): string
63    {
64        return 'POST';
65    }
66}
67