Add update example for javascript client (#6243)
* Add update example for javascript client Signed-off-by: Nuhman Pk <62880706+nuhmanpk@users.noreply.github.com> * Update _clients/javascript/index.md Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> --------- Signed-off-by: Nuhman Pk <62880706+nuhmanpk@users.noreply.github.com> Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
This commit is contained in:
parent
53f4683b41
commit
53d986d7c2
|
@ -327,6 +327,27 @@ var response = await client.search({
|
||||||
```
|
```
|
||||||
{% include copy.html %}
|
{% include copy.html %}
|
||||||
|
|
||||||
|
## Updating a document
|
||||||
|
|
||||||
|
You can update a document using the client's `update` method:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var response = await client.update({
|
||||||
|
index: index_name,
|
||||||
|
id: id,
|
||||||
|
body: {
|
||||||
|
doc: {
|
||||||
|
// Specify the fields and their updated values here
|
||||||
|
field1: "new_value1",
|
||||||
|
field2: "new_value2",
|
||||||
|
// Add more fields as needed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
{% include copy.html %}
|
||||||
|
|
||||||
## Deleting a document
|
## Deleting a document
|
||||||
|
|
||||||
You can delete a document using the client's `delete` method:
|
You can delete a document using the client's `delete` method:
|
||||||
|
|
Loading…
Reference in New Issue