Delete documents

POST /indexes/{indexUid}/documents/delete

Delete a selection of documents based on a filter.

Headers

  • Content-Type string Required

    Payload content-type

    Value is application/json.

Path parameters

  • indexUid string Required

    Index Unique Identifier

application/json

Body Required

  • filter array[string] | string | array[array | string]
    One of:

    Attribute(s) to filter on.

    Can be made of 3 syntaxes

    • Nested Array: ["something > 1", "genres=comedy", ["genres=horror", "title=batman"]]
    • String: "something > 1 AND genres=comedy AND (genres=horror OR title=batman)"
    • Mixed: ["something > 1 AND genres=comedy", "genres=horror OR title=batman"]


    _geoRadius({lat}, {lng}, {distance_in_meters}) and _geoBoundingBox([{lat, lng}], [{lat}, {lng}]) built-in filter rules can be used to filter documents within geo shapes.


    Attribute(s) used in filter should be declared as filterable attributes. See Filtering and Faceted Search.

    Format of each should match the following pattern: ^[^:]+:[^:]+$.

    Attribute(s) to filter on.

    Can be made of 3 syntaxes

    • Nested Array: ["something > 1", "genres=comedy", ["genres=horror", "title=batman"]]
    • String: "something > 1 AND genres=comedy AND (genres=horror OR title=batman)"
    • Mixed: ["something > 1 AND genres=comedy", "genres=horror OR title=batman"]


    _geoRadius({lat}, {lng}, {distance_in_meters}) and _geoBoundingBox([{lat, lng}], [{lat}, {lng}]) built-in filter rules can be used to filter documents within geo shapes.


    Attribute(s) used in filter should be declared as filterable attributes. See Filtering and Faceted Search.

    Format should match the following pattern: ^[^:]+:[^:]+$.

    Attribute(s) to filter on.

    Can be made of 3 syntaxes

    • Nested Array: ["something > 1", "genres=comedy", ["genres=horror", "title=batman"]]
    • String: "something > 1 AND genres=comedy AND (genres=horror OR title=batman)"
    • Mixed: ["something > 1 AND genres=comedy", "genres=horror OR title=batman"]


    _geoRadius({lat}, {lng}, {distance_in_meters}) and _geoBoundingBox([{lat, lng}], [{lat}, {lng}]) built-in filter rules can be used to filter documents within geo shapes.


    Attribute(s) used in filter should be declared as filterable attributes. See Filtering and Faceted Search.

Responses

  • 202 application/json

    Accepted

  • 401 application/json

    Unauthorized

    Hide response attributes Show response attributes object
  • 404

    Not Found

POST /indexes/{indexUid}/documents/delete
curl \
 -X POST https://example.meilisearch.com:7700/indexes/movies/documents/delete \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"offset":2,"limit":5,"fields":["name","picture"],"filter":"doggo = \"bernese mountain\""}'
Request example
# Headers
Content-Type: application/json

# Payload
{
  "offset": 2,
  "limit": 5,
  "fields": [
    "name",
    "picture"
  ],
  "filter": "doggo = \"bernese mountain\""
}
Response examples (202)
{
  "taskUid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "type": "documentDeletion",
  "enqueuedAt": "2021-01-01T09:39:00.000000Z"
}
Response examples (401)
{
  "message": "The Authorization header is missing. It must use the bearer authorization method.",
  "code": "missing_authorization_header",
  "type": "auth",
  "link": "https://docs.meilisearch.com/errors#missing_authorization_header"
}