Index

Update a document in a table

Update one or several documents. The update can be made by passing the id or by using a match query in case multiple documents can be updated. For example update a document using document id:

{'table':'movies','doc':{'rating':9.49},'id':100}

And update by using a match query:

{
  'table':'movies',
  'doc':{'rating':9.49},
  'query':
  {
    'bool':
    {
      'must':
      [
        {'query_string':'new movie'}
      ]
    }
  }
}

The match query has same syntax as for searching. Responds with an object that tells how many documents where updated in format:

{'table':'products','updated':1}
post/update

Request body

tablestring required

Name of the document table

clusterstring

Name of the document cluster

docobject required

Object containing the document fields to update

idinteger

Example request

{
  "doc": {
    "gid": 10
  }
}

Response

item updated

tablestring

Name of the document table

updatedinteger

Number of documents updated

idinteger
resultstring

Result of the update operation, typically 'updated'

Example response

{
  "table": "test",
  "updated": 29
}

Changes