com.sksamuel.elastic4s.handlers.searches.queries.span.SpanWithinQueryBodyFn.scala Maven / Gradle / Ivy
package com.sksamuel.elastic4s.handlers.searches.queries.span
import com.sksamuel.elastic4s.handlers.searches.queries
import com.sksamuel.elastic4s.json.{XContentBuilder, XContentFactory}
import com.sksamuel.elastic4s.requests.searches.span.SpanWithinQuery
object SpanWithinQueryBodyFn {
def apply(q: SpanWithinQuery): XContentBuilder = {
val builder = XContentFactory.jsonBuilder()
builder.startObject("span_within")
builder.rawField("little", queries.QueryBuilderFn(q.little))
builder.rawField("big", queries.QueryBuilderFn(q.big))
q.boost.foreach(builder.field("boost", _))
q.queryName.foreach(builder.field("_name", _))
builder.endObject()
builder.endObject()
}
}