public function testGetMappings() { $configs = ['my_index' => ['mappings' => ['my_type' => ['config'], 'my_type_2' => ['config']]]]; $testedInstance = new IndexConfigurationRepository($configs); $mappings = $testedInstance->getMappings('my_index'); $this->assertEquals(['my_type' => ['config'], 'my_type_2' => ['config']], $mappings); }
/** * Handle index creation command * * @param Client $client * @param string $index * @param string $type * @param string $alias */ public function handle(Client $client, $index, $type, $alias) { $mapping = $this->configurations->getMapping($alias, $type); if (!$mapping) { throw new \InvalidArgumentException(); } $client->getIndex($index)->getType($type)->setMapping($mapping); }
/** * Handle index creation command * * @param Client $client * @param string $index * @param string $alias */ public function handle(Client $client, $index, $alias) { $config = $this->configurations->get($alias); if (null === $config) { throw new \InvalidArgumentException(); } $client->getIndex($index)->create($config); }
/** * Handle index creation command * * @param Client $client * @param string $index * @param string $alias */ public function handle(Client $client, $index, $alias) { $settings = $this->configurations->getSettings($alias); if (null === $settings) { throw new \InvalidArgumentException(); } $client->getIndex($index)->setSettings($settings); }