res.vtl #set( $items = [] ) #foreach( $entry in $context.result.hits.hits ) #if( !$foreach.hasNext ) #set( $nextToken = $util.base64Encode($util.toJson($entry.sort)) ) #end $util.qr($items.add($entry.get("_source"))) #end $util.toJson({ "items": $items, "total": $ctx.result.hits.total.value, "nextToken": $nextToken })
req.vtl #set( $indexPath = "/XXXXXXXXXXXXXX" ) #set( $distance = $util.defaultIfNull($ctx.args.km, 200) ) { "version": "2017-02-28", "operation": "GET", "path": "$indexPath.toLowerCase()", "params": { "body": { "query": { "bool": { "must": { "match_all": {} }, "filter": { "geo_distance": { "distance": "${distance}km", "location": $util.toJson($ctx.args.location) } } } } } } }
标签:distance,hits,set,自定义,items,AWS,util,AppSync,nextToken From: https://www.cnblogs.com/4FFNNNN/p/16994609.html