index_documents

in profile/benchmarking/complex.rb [46:75]


      def index_documents(opts = {})
        results = []
        slices = dataset_slices

        warmup_repetitions.times do
          slices.each do |slice|
            client.bulk(body: slice)
          end
        end

        duration = with_cleanup do
          Benchmark.realtime do
            results = measured_repetitions.times.collect do
              Benchmark.realtime do
                slices.each do |slice|
                  client.bulk(body: slice)
                end
              end
            end
          end
        end

        options = { duration: duration,
                    operation: __method__,
                    dataset: File.basename(DATASET_FILE),
                    dataset_size: ObjectSpace.memsize_of(dataset),
                    dataset_n_documents: dataset.length }
        index_results!(results, options)
      end