How do i implement elasticsearch scripts in nodejs using elasticsearch npm

I wanted to maintain a field in my ES doc that maintains the count of every time I make a request to that doc such as an update request. I am unable to make a syntax of a node query. Please help me with this.

My query on console is:
POST /test_index_1/_doc/{id}/_update
{
"script" : "ctx._source.visits+=1",
"upsert": {
"visits": 1
}
}
I want to make this Query in nodejs.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.