| @@ 16-56 (lines=41) @@ | ||
| 13 | * |
|
| 14 | * @author gbprod <[email protected]> |
|
| 15 | */ |
|
| 16 | class CreateIndexCommand extends ContainerAwareCommand |
|
| 17 | { |
|
| 18 | protected function configure() |
|
| 19 | { |
|
| 20 | $this |
|
| 21 | ->setName('elasticsearch:index:create') |
|
| 22 | ->setDescription('Create index from configuration') |
|
| 23 | ->addArgument( |
|
| 24 | 'client_id', |
|
| 25 | InputArgument::REQUIRED, |
|
| 26 | 'Which client ?' |
|
| 27 | ) |
|
| 28 | ->addArgument( |
|
| 29 | 'index_id', |
|
| 30 | InputArgument::REQUIRED, |
|
| 31 | 'Which index ?' |
|
| 32 | ) |
|
| 33 | ; |
|
| 34 | } |
|
| 35 | ||
| 36 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 37 | { |
|
| 38 | $clientId = $input->getArgument('client_id'); |
|
| 39 | $indexId = $input->getArgument('index_id'); |
|
| 40 | ||
| 41 | $output->writeln(sprintf( |
|
| 42 | '<info>Creating index <comment>%s</comment> for client <comment>%s</comment>...</info>', |
|
| 43 | $indexId, |
|
| 44 | $clientId |
|
| 45 | )); |
|
| 46 | ||
| 47 | $handler = $this |
|
| 48 | ->getContainer() |
|
| 49 | ->get('gbprod.elasticsearch_extra.create_index_handler') |
|
| 50 | ; |
|
| 51 | ||
| 52 | $handler->handle($clientId, $indexId); |
|
| 53 | ||
| 54 | $output->writeln('done'); |
|
| 55 | } |
|
| 56 | } |
|
| @@ 16-56 (lines=41) @@ | ||
| 13 | * |
|
| 14 | * @author gbprod <[email protected]> |
|
| 15 | */ |
|
| 16 | class PutIndexSettingsCommand extends ContainerAwareCommand |
|
| 17 | { |
|
| 18 | protected function configure() |
|
| 19 | { |
|
| 20 | $this |
|
| 21 | ->setName('elasticsearch:index:put_settings') |
|
| 22 | ->setDescription('Put index settings from configuration') |
|
| 23 | ->addArgument( |
|
| 24 | 'client_id', |
|
| 25 | InputArgument::REQUIRED, |
|
| 26 | 'Which client ?' |
|
| 27 | ) |
|
| 28 | ->addArgument( |
|
| 29 | 'index_id', |
|
| 30 | InputArgument::REQUIRED, |
|
| 31 | 'Which index ?' |
|
| 32 | ) |
|
| 33 | ; |
|
| 34 | } |
|
| 35 | ||
| 36 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 37 | { |
|
| 38 | $clientId = $input->getArgument('client_id'); |
|
| 39 | $indexId = $input->getArgument('index_id'); |
|
| 40 | ||
| 41 | $output->writeln(sprintf( |
|
| 42 | '<info>Put index <comment>%s</comment> settings for client <comment>%s</comment>...</info>', |
|
| 43 | $indexId, |
|
| 44 | $clientId |
|
| 45 | )); |
|
| 46 | ||
| 47 | $handler = $this |
|
| 48 | ->getContainer() |
|
| 49 | ->get('gbprod.elasticsearch_extra.put_index_settings_handler') |
|
| 50 | ; |
|
| 51 | ||
| 52 | $handler->handle($clientId, $indexId); |
|
| 53 | ||
| 54 | $output->writeln('done'); |
|
| 55 | } |
|
| 56 | } |
|
| @@ 16-56 (lines=41) @@ | ||
| 13 | * |
|
| 14 | * @author gbprod <[email protected]> |
|
| 15 | */ |
|
| 16 | class PutIndexMappingsCommand extends ContainerAwareCommand |
|
| 17 | { |
|
| 18 | protected function configure() |
|
| 19 | { |
|
| 20 | $this |
|
| 21 | ->setName('elasticsearch:index:put_mappings') |
|
| 22 | ->setDescription('Put index mappings from configuration') |
|
| 23 | ->addArgument( |
|
| 24 | 'client_id', |
|
| 25 | InputArgument::REQUIRED, |
|
| 26 | 'Which client ?' |
|
| 27 | ) |
|
| 28 | ->addArgument( |
|
| 29 | 'index_id', |
|
| 30 | InputArgument::REQUIRED, |
|
| 31 | 'Which index ?' |
|
| 32 | ) |
|
| 33 | ; |
|
| 34 | } |
|
| 35 | ||
| 36 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 37 | { |
|
| 38 | $clientId = $input->getArgument('client_id'); |
|
| 39 | $indexId = $input->getArgument('index_id'); |
|
| 40 | ||
| 41 | $output->writeln(sprintf( |
|
| 42 | '<info>Put index <comment>%s</comment> settings for client <comment>%s</comment>...</info>', |
|
| 43 | $indexId, |
|
| 44 | $clientId |
|
| 45 | )); |
|
| 46 | ||
| 47 | $handler = $this |
|
| 48 | ->getContainer() |
|
| 49 | ->get('gbprod.elasticsearch_extra.put_index_mappings_handler') |
|
| 50 | ; |
|
| 51 | ||
| 52 | $handler->handle($clientId, $indexId); |
|
| 53 | ||
| 54 | $output->writeln('done'); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||