@@ -68,19 +68,19 @@ def reindex(arguments={})
68
68
#
69
69
# reindex = Elasticsearch::Extensions::Reindex.new \
70
70
# source: { index: 'test1', client: client },
71
- # target: { index: 'test2' },
72
- # transform: lambda { |doc| doc['_source']['category'].upcase! }
71
+ # target: { index: 'test2', transform: lambda { |doc| doc['_source']['category'].upcase! } }
72
+ #
73
73
#
74
74
# The reindexing process works by "scrolling" an index and sending
75
75
# batches via the "Bulk" API to the target index/cluster
76
76
#
77
77
# @option arguments [String] :source The source index/cluster definition (*Required*)
78
78
# @option arguments [String] :target The target index/cluster definition (*Required*)
79
+ # @option arguments [Proc] :transform A block which will be executed for each document
79
80
# @option arguments [Integer] :batch_size The size of the batch for scroll operation (Default: 1000)
80
81
# @option arguments [String] :scroll The timeout for the scroll operation (Default: 5min)
81
82
# @option arguments [Boolean] :refresh Whether to refresh the target index after
82
83
# the operation is completed (Default: false)
83
- # @option arguments [Proc] :transform A block which will be executed for each document
84
84
#
85
85
# Be aware, that if you want to change the target index settings and/or mappings,
86
86
# you have to do so in advance by using the "Indices Create" API.
@@ -137,7 +137,7 @@ def perform
137
137
bulk = documents . map do |doc |
138
138
doc [ '_index' ] = arguments [ :target ] [ :index ]
139
139
140
- arguments [ :target ] [ : transform] . call ( doc ) if arguments [ :target ] [ :transform ]
140
+ arguments [ :transform ] . call ( doc ) if arguments [ :transform ]
141
141
142
142
doc [ 'data' ] = doc [ '_source' ]
143
143
doc . delete ( '_score' )
0 commit comments