Search code examples
vespa

How to delete all documents in a Vespa index?


What is a clean way to delete all documents in a Vespa index and leave everything else as it is?

Please share API or Vespa CLI option, if it exists.

I want to empty the index, all docs at once.

I found this command: $ vespa document -v remove id:news:news::1 but this is for deleting individual docs.


Solution

  • You can find five ways to do it at this documentation page.

    I recommend the fourth:

    curl -X DELETE \
      "$ENDPOINT/document/v1/my_namespace/my_doctype/docid?selection=true&cluster=my_cluster"