From 800b1ecb5532574338351c52ddc98fd920e15396 Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Tue, 14 Nov 2017 16:28:11 +0000 Subject: [PATCH] Add Ingest\ProcessorGrok endpoint --- .../Endpoints/Ingest/ProcessorGrok.php | 43 +++++++++++++++++++ .../Namespaces/IngestNamespace.php | 19 ++++++++ 2 files changed, 62 insertions(+) create mode 100644 src/Elasticsearch/Endpoints/Ingest/ProcessorGrok.php diff --git a/src/Elasticsearch/Endpoints/Ingest/ProcessorGrok.php b/src/Elasticsearch/Endpoints/Ingest/ProcessorGrok.php new file mode 100644 index 000000000..431b56057 --- /dev/null +++ b/src/Elasticsearch/Endpoints/Ingest/ProcessorGrok.php @@ -0,0 +1,43 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class ProcessorGrok extends AbstractEndpoint +{ + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + return "/_ingest/processor/grok"; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return []; + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/src/Elasticsearch/Namespaces/IngestNamespace.php b/src/Elasticsearch/Namespaces/IngestNamespace.php index c14313b2f..93f904615 100644 --- a/src/Elasticsearch/Namespaces/IngestNamespace.php +++ b/src/Elasticsearch/Namespaces/IngestNamespace.php @@ -4,6 +4,7 @@ use Elasticsearch\Endpoints\Ingest\Pipeline\Delete; use Elasticsearch\Endpoints\Ingest\Pipeline\Get; +use Elasticsearch\Endpoints\Ingest\Pipeline\ProcessorGrok; use Elasticsearch\Endpoints\Ingest\Pipeline\Put; use Elasticsearch\Endpoints\Ingest\Simulate; @@ -111,4 +112,22 @@ public function simulate($params = array()) return $this->performRequest($endpoint); } + + /** + * $params[] + * + * @param $params array Associative array of parameters + * + * @return array + */ + public function processorGrok($params = []) + { + /** @var callback $endpointBuilder */ + $endpointBuilder = $this->endpoints; + + /** @var ProcessorGrok $endpoint */ + $endpoint = $endpointBuilder('Ingest\ProcessorGrok'); + + return $this->performRequest($endpoint); + } }