How to delete only type in elasticsearch 2.4

Hi team,

when insert data to elasticsearch, i have
GET /news/testing/
GET /news/trkd/
GET /news/nar/

the type will be different. How to delete the type i need?
when i use DELETE news/trkd/ , the error will be show 'No handler found for uri [/news/trkd/] and method [DELETE]'.
If i use DELETE news/ it will success, but it will delete all type i insert.
How to delete type i need ?

Thanks and Best regards
Sharon

Hi @Sharon_wsf,

you need to install the delete by query plugin and then delete all documents belonging to that type with a query, e.g.:

DELETE /news/testing/_query
{
  "query": { 
      "match_all": {}
  }
}

A better solution is to use multiple indexes instead of multiple types. You can use aliases to assign alternative names to indices.

Daniel

1 Like

Thanks for your helping..
What is the meaning aliases to assign alternative name to indices?
Can have example?
Sorry, im new in elasticsearch, but the guide not very clear, so most if it i not very understand..

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.