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

com.sksamuel.elastic4s.handlers.fields.AliasFieldBuilderFn.scala Maven / Gradle / Ivy

package com.sksamuel.elastic4s.handlers.fields

import com.sksamuel.elastic4s.fields.AliasField
import com.sksamuel.elastic4s.json.{XContentBuilder, XContentFactory}

object AliasFieldBuilderFn {
  def toField(name: String, values: Map[String, Any]): AliasField = {
    AliasField(name, values.get("path").map(_.asInstanceOf[String]).get)
  }

  def build(field: AliasField): XContentBuilder = {
    val builder = XContentFactory.jsonBuilder()
    builder.field("type", field.`type`)
    builder.field("path", field.path)
    builder.endObject()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy