Hit

trait Hit

A common trait for Get, MultiGet, Search and MultiSearch results to provide common functionality for the HitReader typeclass.

class Object
trait Matchable
class Any

Value members

Abstract methods

def exists: Boolean
def id: String
def index: String
def primaryTerm: Long
def score: Float
def seqNo: Long
def sourceAsMap: Map[String, AnyRef]
def sourceAsString: String
def version: Long

Concrete methods

final def isSourceEmpty: Boolean
final def ref: DocumentRef
final def safeTo[T](implicit reader: HitReader[T]): Try[T]

Uses a HitReader typeclass to convert the returned source into type T. This method will return a Left[Throwable] if there was an error during the marshalling, otherwise it will return a Right[T]

Uses a HitReader typeclass to convert the returned source into type T. This method will return a Left[Throwable] if there was an error during the marshalling, otherwise it will return a Right[T]

final def safeToOpt[T : HitReader]: Option[Try[T]]
final def sourceAsByteBuffer: ByteBuffer
final def sourceAsBytes: Array[Byte]
final def sourceAsMutableMap: Map[String, AnyRef]
final def sourceField(name: String): AnyRef
final def sourceFieldOpt(name: String): Option[AnyRef]
final def to[T : HitReader]: T

Uses a HitReader typeclass to convert the returned source into type T. This method will throw an exception if the marshalling process fails

Uses a HitReader typeclass to convert the returned source into type T. This method will throw an exception if the marshalling process fails

final def toOpt[T : HitReader]: Option[T]

Returns a Some(t) if the hit exists. It might not exist (an empty hit) if this was returned by a Get request and the given id did not exist, in which case it will return None.

Returns a Some(t) if the hit exists. It might not exist (an empty hit) if this was returned by a Get request and the given id did not exist, in which case it will return None.