Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 如何在velocity模板(AWS appsync和elasticsearch)中使用字符串替换?_Amazon Web Services_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Variadic Templates_Aws Appsync - Fatal编程技术网 elasticsearch,variadic-templates,aws-appsync,Amazon Web Services,elasticsearch,Variadic Templates,Aws Appsync" /> elasticsearch,variadic-templates,aws-appsync,Amazon Web Services,elasticsearch,Variadic Templates,Aws Appsync" />

Amazon web services 如何在velocity模板(AWS appsync和elasticsearch)中使用字符串替换?

Amazon web services 如何在velocity模板(AWS appsync和elasticsearch)中使用字符串替换?,amazon-web-services,elasticsearch,variadic-templates,aws-appsync,Amazon Web Services,elasticsearch,Variadic Templates,Aws Appsync,我正在编写一个appsync查询,以从elastic(使用velocity模板)按电话号码搜索记录 弹性体上存储的数据的格式为“0123456789”,但请求的格式可能为“012-123-1234”。所以我打算使用字符串替换函数来删除“-”字符。但是,我的代码返回以下错误: "message": "Lexical error, Encountered: \" _ \ "(95), after: \". \ "at * unset * [line 11, column 51]" 我不确定我的书写

我正在编写一个appsync查询,以从elastic(使用velocity模板)按电话号码搜索记录

弹性体上存储的数据的格式为“0123456789”,但请求的格式可能为“012-123-1234”。所以我打算使用字符串替换函数来删除“-”字符。但是,我的代码返回以下错误:

"message": "Lexical error, Encountered: \" _ \ "(95), after: \". \ "at * unset * [line 11, column 51]"
我不确定我的书写是否正确,请帮忙

这是我的代码:

{
    "version":"2017-02-28",
    "operation":"GET",
    "path":"/res/res/_search",
    "params":{
        "headers":{},
        "queryString":{},
        "body":{
            "from":$util.defaultIfNull($ctx.args.nextToken, 0),
            "size":$util.defaultIfNull($ctx.args.limit, 20),
            "query": {
                 "match": { "phoneNumber": "$context.args.phoneNumber".replace('-', '') }
            }
        }
    }
}

嗯,我发现了错误,是“字符”的错误位置

"match": { "phoneNumber": "$context.args.phoneNumber".replace('-', '') }
"match": { "phoneNumber": "$context.args.phoneNumber.replace('-', '')" }
=>