Skip to content

Instantly share code, notes, and snippets.

View sksamuel's full-sized avatar
💭
I may be slow to respond.

Sam sksamuel

💭
I may be slow to respond.
  • Grindr
  • Chicago, IL
  • 06:16 (UTC -05:00)
  • X @_sksamuel
View GitHub Profile
@sksamuel
sksamuel / aggsconvert.scala
Last active June 30, 2017 05:46
conversion of 1.4 elasticsearch aggs into elastic4s 6.0 map
def aggregationAsMap(aggregations: Aggregations): Map[String, Map[String, AnyRef]] = {
import scala.collection.JavaConverters._
def convert(agg: Aggregation): Map[String, AnyRef] = {
agg match {
case terms: StringTerms =>
val buckets = terms.getBuckets.asScala.map { bucket =>
Map(