---
title: "Update a document in a table"
method: POST
path: "/update"
tags: ["Index"]
---

# Update a document in a table

`POST /update`

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}
  ```

## Request body

- UpdateDocumentRequest — Payload for updating a document or multiple documents in a table
  - `table` string, required — Name of the document table
  - `cluster` string — Name of the document cluster
  - `doc` object, required — Object containing the document fields to update
  - `id` integer
  - `query` QueryFilter — Object used to apply various conditions, such as full-text matching or attribute filtering, to a search query
    - `query_string` string — Filter object defining a query string
    - `match` object — Filter object defining a match keyword passed as a string or in a Match object
    - `match_phrase` object — Filter object defining a match phrase
    - `match_all` object — Filter object to select all documents
    - `bool` BoolFilter
      - `must` QueryFilter[] — Query clauses that must match for the document to be included
      - `must_not` QueryFilterAlias1[] — Query clauses that must not match for the document to be included
        - `query_string` string — Filter object defining a query string
        - `match` object — Filter object defining a match keyword passed as a string or in a Match object
        - `match_phrase` object — Filter object defining a match phrase
        - `match_all` object — Filter object to select all documents
        - `bool` BoolFilter — recursive
        - `equals` QueryFilterAllOfEquals — Filter to match exact attribute values.
        - `in` QueryFilterAllOfIn — Filter to match a given set of attribute values.
        - `range` QueryFilterAllOfRange — Filter to match a given range of attribute values passed in Range objects
        - `geo_distance` GeoDistance — Object to perform geo-distance based filtering on queries
          - `location_anchor` GeoDistanceLocationAnchor — Specifies the location of the pin point used for search
            - `lat` number — Latitude of the anchor point
            - `lon` number — Longitude of the anchor point
          - `location_source` string — Field name in the document that contains location data
          - `distance_type` 'adaptive' | 'haversine' — Algorithm used to calculate the distance
          - `distance` string — The distance from the anchor point to filter results by
      - `should` QueryFilterAlias2[] — Query clauses that should be matched, but are not required
        - `query_string` string — Filter object defining a query string
        - `match` object — Filter object defining a match keyword passed as a string or in a Match object
        - `match_phrase` object — Filter object defining a match phrase
        - `match_all` object — Filter object to select all documents
        - `bool` BoolFilter — recursive
        - `equals` QueryFilterAllOfEquals — Filter to match exact attribute values.
        - `in` QueryFilterAllOfIn — Filter to match a given set of attribute values.
        - `range` QueryFilterAllOfRange — Filter to match a given range of attribute values passed in Range objects
        - `geo_distance` GeoDistance — Object to perform geo-distance based filtering on queries
          - `location_anchor` GeoDistanceLocationAnchor — Specifies the location of the pin point used for search
            - `lat` number — Latitude of the anchor point
            - `lon` number — Longitude of the anchor point
          - `location_source` string — Field name in the document that contains location data
          - `distance_type` 'adaptive' | 'haversine' — Algorithm used to calculate the distance
          - `distance` string — The distance from the anchor point to filter results by
    - `equals` QueryFilterAllOfEquals — Filter to match exact attribute values.
    - `in` QueryFilterAllOfIn — Filter to match a given set of attribute values.
    - `range` QueryFilterAllOfRange — Filter to match a given range of attribute values passed in Range objects
    - `geo_distance` GeoDistance — Object to perform geo-distance based filtering on queries
      - `location_anchor` GeoDistanceLocationAnchor — Specifies the location of the pin point used for search
        - `lat` number — Latitude of the anchor point
        - `lon` number — Longitude of the anchor point
      - `location_source` string — Field name in the document that contains location data
      - `distance_type` 'adaptive' | 'haversine' — Algorithm used to calculate the distance
      - `distance` string — The distance from the anchor point to filter results by

## Response `200`

item updated

- UpdateResponse — Success response returned after updating one or more documents
  - `table` string — Name of the document table
  - `updated` integer — Number of documents updated
  - `id` integer
  - `result` string — Result of the update operation, typically 'updated'

## Other responses

- `default` — error

## Changes

> 13 revisions in range; 2 could not be searched.

- **2025-10-22** `ccbf4be3d884` — 1 warning
  - removed `subschema #2` from the `query` request property `allOf` list
- **2025-07-31** `50c351a99940` — 1 breaking
  - the `query/allOf[subschema #2]/equals` request property type/format changed from ``/`` to `object`/``
- **2025-06-30** `1911b776f18a` — 2 breaking
  - the `id` request property type/format changed from `integer`/`int64` to `integer`/`uint64`
  - the `id` response's property type/format changed from `integer`/`int64` to `integer`/`uint64` for status `200`
- **2025-04-01** `0e6cccea382d` — 1 warning, 1 info
  - removed the optional property `_id` from the response with the `200` status
  - added the optional property `id` to the response with the `200` status
- **2025-02-13** `8f90aac993c7` — 1 breaking, 3 warning, 2 info
  - added the new required request property `table`
  - removed the request property `index`
  - removed the optional property `_index` from the response with the `200` status
  - removed the optional property `error/oneOf[#/components/schemas/responseErrorDetails]/index` from the response with the `default` status
  - …2 more

[Full history](https://skmtc.dev/manticoresoftware/apis/manticore-search-client/changes/update/post.md)

---

[API](https://skmtc.dev/manticoresoftware/apis/manticore-search-client.md) · [All operations](https://skmtc.dev/manticoresoftware/apis/manticore-search-client/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/manticoresoftware/manticore-search-client/revisions/eb39c8083035/schema)
