Code Duplication    Length = 16-19 lines in 2 locations

Service/IndexService.php 2 locations

@@ 338-353 (lines=16) @@
335
        return $results['count'];
336
    }
337
338
    public function remove($id, $routing = null)
339
    {
340
        $params = [
341
            'index' => $this->getIndexName(),
342
            'type' => $this->getTypeName(),
343
            'id' => $id,
344
        ];
345
346
        if ($routing) {
347
            $params['routing'] = $routing;
348
        }
349
350
        $response = $this->getClient()->delete($params);
351
352
        return $response;
353
    }
354
355
    public function update($id, array $fields = [], $script = null, array $params = []): array
356
    {
@@ 377-395 (lines=19) @@
374
        return $this->getClient()->update($params);
375
    }
376
377
    public function search(array $query, array $params = []): array
378
    {
379
        $requestParams = [
380
            'index' => $this->getIndexName(),
381
            'type' => $this->getTypeName(),
382
            'body' => $query,
383
        ];
384
385
386
        if (!empty($params)) {
387
            $requestParams = array_merge($requestParams, $params);
388
        }
389
390
//        $this->stopwatch('start', 'search');
391
        $result = $this->getClient()->search($requestParams);
392
//        $this->stopwatch('stop', 'search');
393
394
        return $result;
395
    }
396
397
    /**
398
     * Usage example