Búsqueda elástica de tiempo de espera del índice masivo err! Error: Tiempo de espera de solicitud después de 30000 ms

Recientemente, quiero desplazarme por los datos del índice anterior a nuevos índices mensuales. Los datos almacenados comienzan desde 2015/07 hasta ahora. y son casi 30,000 registros por mes. Siga elDesplazarse yabultar métodos proporcionados en2.2 API, Termino el código de la siguiente manera.

archivocafé principal

logger = require 'graceful-logger'
elasticsearch = require 'elasticsearch'
setMonthlyIndices = require './es-test-promise'
client = new elasticsearch.Client
  host:
    host: 'localhost'
    port: 9200
    protocol: 'http'
setMonthlyIndices client, 'es_test_messages', 'talk_messages_v2', 'messages', 2015, 6    

archivoes-test-promise.coffee

logger = require 'graceful-logger'
elasticsearch = require 'elasticsearch'
config = require 'config'

setIndice = (client, prefix, index, type, year, month) ->
  allDocs = []
  count = 0

  prevYear = year + ''
  # with leading '0' for month less than 10
  prevMonth = ("0" + month).slice(-2)
  nextDate = new Date(year, month)
  nextYear = nextDate.getFullYear().toString()
  nextMonth = ("0" + (nextDate.getMonth()+1)).slice(-2)

  minDate = "#{prevYear}-#{prevMonth}-01"
  maxDate = "#{nextYear}-#{nextMonth}-01"

  indice_name = "#{prefix}_#{prevYear}_#{prevMonth}"

  q =
    filtered:
      filter:
        range:
          createdAt:
            gte: minDate
            lt: maxDate
            format: "yyyy-MM-dd"

  client.search
    index: index
    type: type
    scroll: '1m'
    body:
      query: q
    sort: ['_doc']
    size: 1000
  , callback = (err, response) ->
    console.log "indice_name 1", indice_name
    return logger.err err.stack if err
    return unless response.hits?.total

    allDocs = []

    response.hits.hits.forEach (hit)->
      action =
        index:
          _id: hit._id
      allDocs.push(action)
      allDocs.push(hit._source)

    count = count + allDocs.length

    client.bulk
      index: indice_name
      type: type
      body: allDocs
    , (err, resp) ->
      console.log "indice_name 2", indice_name
      return logger.err err.stack if err

      if response.hits.total *2 !=  count
        client.scroll
          scrollId: response._scroll_id
          scroll: '1m'
        , callback
      else
        logger.info "Finish indicing #{indice_name}"

setMonthlyIndices = (client, prefix, index, type, year, month) ->
  current = new Date()
  currentYear = current.getFullYear()
  currentMonth = current.getMonth() + 1

  processYear = year or currentYear
  processMonth = month or 0

  processDate = new Date(processYear, processMonth)
  currentDate = new Date(currentYear, currentMonth)

  processDate = new Date(2015, 6)
  currentDate = new Date(2015, 9)

  while processDate <= currentDate
    year = processDate.getFullYear()
    month = processDate.getMonth() + 1
    setIndice(client, prefix, index, type, year, month)
    processDate.setMonth(processDate.getMonth() + 1)

module.exports = setMonthlyIndices

Me pregunto si se debe abrir demasiadas solicitudes de clientes, porque en el archivoes-test-promise.coffee, todas estas solicitudes de búsqueda se ejecutan simultáneamente. Esto es solo una suposición, y luego también he intentado implementarlo conpromesa para asegurarse de que la solicitud se pueda ejecutar uno por uno. Finalmente, no puedo entenderlo y rendirme.

¿Tiene alguna sugerencia, creo que deberían ser los problemas de origen, pero no sé dónde verificar ...

Respuestas a la pregunta(1)

Su respuesta a la pregunta