Skip to content

Commit

Permalink
Added support for clear scroll command
Browse files Browse the repository at this point in the history
Elasticsearch v0.90.4
See elastic/elasticsearch@4864d15
  • Loading branch information
Fabien Pennequin committed Mar 7, 2014
1 parent 0fdd3c0 commit d53f84b
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/main/scala/scalastic/elasticsearch/Searching.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import org.elasticsearch.common.geo._
trait Searching
extends Query
with Search
with SearchScroll
with MoreLikeThis
with SearchScroll with ClearScroll
with MoreLikeThis
with Multisearch
with Percolate
with ValidateQuery {
Expand Down Expand Up @@ -106,26 +106,26 @@ object SearchParameterTypes {
}

trait SearchScroll {
self: Indexer =>
self: Indexer =>

def searchScroll(
scrollId: String,
listenerThreaded: Option[Boolean] = None,
operationThreading: Option[SearchOperationThreading] = None,
scroll: Option[String] = None) = searchScroll_send(scrollId, listenerThreaded, operationThreading, scroll).actionGet

def searchScroll_send(
scrollId: String,
listenerThreaded: Option[Boolean] = None,
operationThreading: Option[SearchOperationThreading] = None,
scroll: Option[String] = None) = searchScroll_prepare(scrollId, listenerThreaded, operationThreading, scroll).execute

def searchScroll_prepare(
scrollId: String,
listenerThreaded: Option[Boolean] = None,
operationThreading: Option[SearchOperationThreading] = None,
scroll: Option[String] = None) = {
/* method body */
/* method body */
val request = client.prepareSearchScroll(scrollId)
listenerThreaded foreach { request.listenerThreaded(_) }
operationThreading foreach { request.setOperationThreading(_) }
Expand All @@ -134,6 +134,21 @@ trait SearchScroll {
}
}

trait ClearScroll {
self: Indexer =>

def clearScroll(cursorIds: Iterable[String]) = clearScroll_send(cursorIds).actionGet

def clearScroll_send(cursorIds: Iterable[String]) = clearScroll_prepare(cursorIds).execute

def clearScroll_prepare(cursorIds: Iterable[String]) = {
/* method body */
val request = client.prepareClearScroll()
request.setScrollIds(cursorIds.toList)
request
}
}

trait Search {
self: Indexer =>

Expand Down

0 comments on commit d53f84b

Please sign in to comment.