public static function printIndices(
        InputInterface $input,
        OutputInterface $output,
        array $indices
    ) {
        $hasIndices = !empty($indices);
        $table = new Table($output);
        $headers = ['UUID', 'App ID', 'Doc Count', 'Size', 'Ok?', 'shards', 'replicas'];
        $withMetadata = $input->getOption('with-metadata');
        $withFields = $input->getOption('with-fields');
        if ($hasIndices && $withFields) {
            $headers[] = 'Fields';
        }

        if ($hasIndices && $withMetadata) {
            foreach ($indices[0]->getMetadata() as $field => $_) {
                $headers[] = ucfirst($field);
            }
        }

        $table->setHeaders($headers);

        /*
         * @var Index
         */
        foreach ($indices as $index) {
            $row = [
                $index->getUUID()->composeUUID(),
                $index->getAppUUID()->composeUUID(),
                $index->getDocCount(),
                $index->getSize(),
                $index->isOK()
                    ? 'Yes'
                    : 'No',
                $index->getShards(),
                $index->getReplicas(),
            ];

            if ($withFields) {
                $fields = $index->getFields();
                array_walk($fields, function (string &$type, string $field) {
                    $type = "$field: $type";
                });
                $row[] = implode("\n", $fields);
            }

            if ($withMetadata) {
                foreach ($index->getMetadata() as $_ => $value) {
                    $row[] = $value;
                }
            }

            $table->addRow($row);
        }
        $table->render();
    }