This article is a mirror article of machine translation, please click here to jump to the original article.

View: 16991|Reply: 1

Elasticsearch deletes and indexes all document data

[Copy link]
Posted on 12/26/2018 11:25:17 AM | | | |
Query the method of indexing all document data

Send a post request to the interface, url address:http://es.itsvse.com:9200/test3/_search
post content:
{
    "query": {
        "match_all": {}
    }
}
A total of 10 pieces of data were found, as shown in the figure below:


Delete individual pieces of data

The syntax for delete documents is the same as the rules we know, except using the DELETE method:

Interface address:http://es.itsvse.com:9200/test3/News/GPSA6GcBfbIix3bWbjpi/Send a DELETE request, if it returns a 200 status code, it means the deletion was successful, and if the document is not found, a response code of 404 Not Found will be returned. As shown below:




Reference document address:https://www.elastic.co/guide/cn/ ... ent/delete-doc.html

Delete all document data

The simplest use of editing delete via the query API is _delete_by_query perform a delete operation on each document that matches the query.

Interface address:http://es.itsvse.com:9200/test3/_delete_by_query

Send a post request with the following contents:

{
    "query": {
        "match_all": {}
    }
}


Query 9 pieces of data, delete 9 pieces of data, _delete_by_query syntax is to delete the data according to the query results.

Reference Documentation:https://www.elastic.co/guide/en/ ... elete-by-query.html




Previous:A 36-episode video and audio compilation of Chinese moral education stories in the world
Next:C# GZipStream interacts with the database and performs data compression and decompression
 Landlord| Posted on 11/18/2021 3:41:34 PM |
Delete the specified index


Delete the index via wildcard




Official documentation:The hyperlink login is visible.
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com