2

I need to delete the multiple record in specified index/type. i follow this document stil i have same issue

I need to delete all documents in gvisitor type in g_visitor index, i follow below command

curl -XDELETE http://10.1.2.10:9200/g_visitor/gvisitor

its throw below error

No handler found for uri [/g_visitor/gvisitor] and method [DELETE]

Then follow to install Delete By Query plugin and try to remove documents ,

curl -XDELETE 'http://10.1.2.10:9200/g_visitor/gvisitor/_delete_by_query?conflicts=proceed' -d '{
    "query" : { 
        "match_all" : {}
    }
}'

Its throw below error:

  {
     "found":false,
     "_index":"g_visitor",
     "_type":"gvisitor",
     "_id":"_delete_by_query",
     "_version":1,
     "_shards":{
        "total":2,
        "successful":1,
        "failed":0
     }
  }

Suggeset me, How can i delete multiple or all documents in specific type of index in elasticsearch.

2 Answers 2

3

You cannot delete a mapping type, hence why your first query doesn't work.

You can only delete an index

curl -XDELETE http://10.1.2.10:9200/g_visitor

If you want to use the delete-by-query approach, you can do so, but you need to install the plugin first

sudo bin/plugin install delete-by-query

Then you can use the plugin like this by calling the _query endpoint (not _delete_by_query!!):

curl -XDELETE 'http://10.1.2.10:9200/g_visitor/gvisitor/_query?conflicts=proceed' -d '{
    "query" : { 
        "match_all" : {}
    }
}'
Sign up to request clarification or add additional context in comments.

1 Comment

i already installed delete-by-query plugin and try deleted above mentioned way its not works for me
0

if you are using delete-by-query you need to use terms instead of match_all

curl -XDELETE 'http://10.1.2.10:9200/g_visitor/gvisitor/_delete_by_query?conflicts=proceed' -d '{
    "query" : { 
        "terms" : {}
    }
}'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.