Skip to content

Instantly share code, notes, and snippets.

@tobinbc
Last active February 16, 2020 10:58
Show Gist options
  • Save tobinbc/be2a4f1907b2475c5897c72c1f0edba8 to your computer and use it in GitHub Desktop.
Save tobinbc/be2a4f1907b2475c5897c72c1f0edba8 to your computer and use it in GitHub Desktop.
#set( $es_items = [] )
#set( $body = $util.parseJson($context.result.body))
#foreach( $entry in $body.hits.hits )
#set ( $item = {
"tree": $entry.get("_source"),
"distance": $entry.get("sort").get(0)
})
$util.qr($es_items.add($item))
#end
#set( $es_response = {
"items": $es_items
} )
$util.toJson($es_response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment