app-search-node icon indicating copy to clipboard operation
app-search-node copied to clipboard

No option for updating field using string

Open BhupenPal opened this issue 3 years ago • 2 comments

I was trying to update a document with help of a script but didn't find a way through which we can do this.

The same queries in kibana work as expected. But whenever I add a script in app-search API it just adds another field named "script" and adds the script in a stringified format as its value.

BhupenPal avatar Jan 24 '22 07:01 BhupenPal

Can you post an example or something? I don't think I understand what you're asking.

JasonStoltz avatar Jan 26 '22 13:01 JasonStoltz

Elastic Search provides this functionality out of the box, to update or get documents by running some script on the documents while querying.

POST test/_update/1 { "script" : { "source": "ctx._source.counter += params.count", "lang": "painless", "params" : { "count" : 4 } } }

I am able to perform the above query using Elastic Search API's, but I am specifically using Elastic App Search and it also provides API which has different endpoints than ElasticSearch App. But the script isn't working when I use App Search Endpoints.

This WORKS: https://imgur.com/a/0QLhAPZ This DOESN'T: https://imgur.com/a/WbtX58E

BhupenPal avatar Jan 26 '22 14:01 BhupenPal