Skip to content

Add reindex command to CLI #29

@marcosgz

Description

@marcosgz

It's already possible to reset an index and reindex data from old to new using the reindex API. Implement something similar to the index api to let user reindex data from old to index.

The CLI can be something like:

      desc 'reindex *INDEX_CLASSES', 'Reindex documents from the old index to the new index'
      option :from, type: :string, required: true, desc: 'The source index suffix'
      option :to, type: :string, required: true, desc: 'The Target index suffix'
      option :wait_for_completion, type: :boolean, default: true, desc: 'Wait for the reindex task to complete'
      option :wait_interval, type: :numeric, default: 30, desc: 'The interval in seconds to wait for the reindex task to complete'
      def reindex(*index_classes)
        require_relative 'index/reindex'
        Reindex.new(indices: index_classes, **options.to_h.transform_keys(&:to_sym)).run
      end

It should be great if possible to add reindex with painless script of with custom query. But I have no idea right now of a good DSL to CLI. I'll need to think more about it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions