1<?php 2 3declare(strict_types = 1); 4 5namespace Elasticsearch\Namespaces; 6 7use Elasticsearch\Endpoints\Ingest\Pipeline\Delete; 8use Elasticsearch\Endpoints\Ingest\Pipeline\Get; 9use Elasticsearch\Endpoints\Ingest\Pipeline\ProcessorGrok; 10use Elasticsearch\Endpoints\Ingest\Pipeline\Put; 11use Elasticsearch\Endpoints\Ingest\Simulate; 12 13/** 14 * Class IngestNamespace 15 * 16 * @category Elasticsearch 17 * @package Elasticsearch\Namespaces\IngestNamespace 18 * @author Zachary Tong <zach@elastic.co> 19 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 20 * @link http://elastic.co 21 */ 22class IngestNamespace extends AbstractNamespace 23{ 24 /** 25 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 26 * ['timeout'] = (time) Explicit operation timeout 27 * 28 * @return callable|array 29 */ 30 public function deletePipeline(array $params = []) 31 { 32 $id = $this->extractArgument($params, 'id'); 33 34 /** 35 * @var callable $endpointBuilder 36*/ 37 $endpointBuilder = $this->endpoints; 38 39 /** 40 * @var Delete $endpoint 41*/ 42 $endpoint = $endpointBuilder('Ingest\Pipeline\Delete'); 43 $endpoint->setID($id); 44 $endpoint->setParams($params); 45 46 return $this->performRequest($endpoint); 47 } 48 49 /** 50 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 51 * 52 * @return callable|array 53 */ 54 public function getPipeline(array $params = []) 55 { 56 $id = $this->extractArgument($params, 'id'); 57 58 /** 59 * @var callable $endpointBuilder 60*/ 61 $endpointBuilder = $this->endpoints; 62 63 /** 64 * @var Get $endpoint 65*/ 66 $endpoint = $endpointBuilder('Ingest\Pipeline\Get'); 67 $endpoint->setID($id); 68 $endpoint->setParams($params); 69 70 return $this->performRequest($endpoint); 71 } 72 73 /** 74 * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node 75 * ['timeout'] = (time) Explicit operation timeout 76 * 77 * @return callable|array 78 */ 79 public function putPipeline(array $params = []) 80 { 81 $body = $this->extractArgument($params, 'body'); 82 $id = $this->extractArgument($params, 'id'); 83 84 /** 85 * @var callable $endpointBuilder 86*/ 87 $endpointBuilder = $this->endpoints; 88 89 /** 90 * @var Put $endpoint 91*/ 92 $endpoint = $endpointBuilder('Ingest\Pipeline\Put'); 93 $endpoint->setID($id) 94 ->setBody($body) 95 ->setParams($params); 96 97 return $this->performRequest($endpoint); 98 } 99 100 /** 101 * $params['verbose'] = (bool) Verbose mode. Display data output for each processor in executed pipeline 102 * 103 * @return callable|array 104 */ 105 public function simulate(array $params = []) 106 { 107 $body = $this->extractArgument($params, 'body'); 108 $id = $this->extractArgument($params, 'id'); 109 110 /** 111 * @var callable $endpointBuilder 112*/ 113 $endpointBuilder = $this->endpoints; 114 115 /** 116 * @var Simulate $endpoint 117*/ 118 $endpoint = $endpointBuilder('Ingest\Simulate'); 119 $endpoint->setID($id) 120 ->setBody($body) 121 ->setParams($params); 122 123 return $this->performRequest($endpoint); 124 } 125 126 /** 127 * @return callable|array 128 */ 129 public function processorGrok(array $params = []) 130 { 131 /** 132 * @var callable $endpointBuilder 133*/ 134 $endpointBuilder = $this->endpoints; 135 136 /** 137 * @var ProcessorGrok $endpoint 138*/ 139 $endpoint = $endpointBuilder('Ingest\ProcessorGrok'); 140 141 return $this->performRequest($endpoint); 142 } 143} 144