All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sksamuel.elastic4s.requests.bulk.BulkRequest.scala Maven / Gradle / Ivy

There is a newer version: 8.15.4
Show newest version
package com.sksamuel.elastic4s.requests.bulk

import com.sksamuel.elastic4s.ext.OptionImplicits._
import com.sksamuel.elastic4s.requests.common.RefreshPolicy

import scala.concurrent.duration.Duration

case class BulkRequest(requests: Seq[BulkCompatibleRequest],
                       timeout: Option[String] = None,
                       refresh: Option[RefreshPolicy] = None) {

  def timeout(timeout: Duration): BulkRequest = copy(timeout = (timeout.toNanos + "nanos").some)
  def timeout(timeout: String): BulkRequest = copy(timeout = timeout.some)

  def refresh(refresh: RefreshPolicy): BulkRequest = copy(refresh = refresh.some)

  def refreshImmediately: BulkRequest = refresh(RefreshPolicy.IMMEDIATE)
  def waitForRefresh: BulkRequest = refresh(RefreshPolicy.WaitFor)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy