com.sksamuel.elastic4s.handlers.count.CountBodyBuilderFn.scala Maven / Gradle / Ivy
The newest version!
package com.sksamuel.elastic4s.handlers.count
import com.sksamuel.elastic4s.handlers.searches.queries.QueryBuilderFn
import com.sksamuel.elastic4s.json.{XContentBuilder, XContentFactory}
import com.sksamuel.elastic4s.requests.count.CountRequest
object CountBodyBuilderFn {
def apply(request: CountRequest): XContentBuilder = {
val builder = XContentFactory.jsonBuilder()
request.query.map(QueryBuilderFn.apply).foreach(builder.rawField("query", _))
builder
}
}