elasticsearch version: "5.1.2",
code to update the existing document in elasticsearch
script := elastic.NewScript(ctx._source.new_field += params.vijay
).Param("vijay", "kumar").Lang("painless")
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)
}
and this resulted to:
script &{ctx._source.new_field += params.vijay inline painless map[vijay:kumar]}
panic: elastic: Error 400 (Bad Request): [script] unknown field [source], parser not found [type=illegal_argument_exception]
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.