duanbicheng3345 2018-07-30 08:47
浏览 981

弹性:错误400(错误请求):执行脚本失败[type = illegal_argument_exception]

Using gopkg.in/olivere/elastic.v5 for adding a field to a document in elasticsearch Code:

script := elastic.NewScript(`ctx._source.new_field += params.vijay`).Param("vijay", "kumar").p
                //script := elastic.NewScript("ctx._source.retweets += params.num").Param("num", 1)
                fmt.Println("script", script)
                update, err := client.Update().Index("idx001").Type("sdoc").Id(t.Docid).Script(script).Do(ctx)
                if err != nil {
                    // Handle error
                    panic(err)
                }
                fmt.Println("result is", update.Result)

And the result got is(here i am printing the script formed also)

script &{ctx._source.new_field += params.vijay map[vijay:kumar]} panic: elastic: Error 400 (Bad Request): failed to execute script [type=illegal_argument_exception]

Expected the field vijay to be added into elasticsearch with the value kumar

  • 写回答

1条回答 默认 最新

  • ·未· 2020-08-18 15:08
    关注

    可能是客户端和服务端的版本不一致,在引入依赖的时候引入对应服务端的版本依赖

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分