| @@ 13-28 (lines=16) @@ | ||
| 10 | use ElasticSearchProcessorTrait; |
|
| 11 | use ConfiguratorTrait; |
|
| 12 | ||
| 13 | public function write(array $document) |
|
| 14 | { |
|
| 15 | $documents = $this |
|
| 16 | ->getProcessor() |
|
| 17 | ->process($document); |
|
| 18 | ||
| 19 | foreach ($documents as $document) { |
|
| 20 | $params = [ |
|
| 21 | 'index' => $this->indexName, |
|
| 22 | 'type' => $this->typeName, |
|
| 23 | 'body' => $document |
|
| 24 | ]; |
|
| 25 | ||
| 26 | Client::getInstance()->index($params); |
|
| 27 | } |
|
| 28 | } |
|
| 29 | ||
| 30 | public function writeOne(array $document) |
|
| 31 | { |
|
| @@ 30-43 (lines=14) @@ | ||
| 27 | } |
|
| 28 | } |
|
| 29 | ||
| 30 | public function writeOne(array $document) |
|
| 31 | { |
|
| 32 | $doc = $this |
|
| 33 | ->getProcessor() |
|
| 34 | ->process($document); |
|
| 35 | ||
| 36 | $params = [ |
|
| 37 | 'index' => $this->indexName, |
|
| 38 | 'type' => $this->typeName, |
|
| 39 | 'body' => $doc |
|
| 40 | ]; |
|
| 41 | ||
| 42 | Client::getInstance()->index($params); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||