elasticsearchujson

Deleting an Index from ElasticSearch using Id from terminal


Given below is my UJSON (Ultra JSON) object of the index which I want to delete from ElasticSeach

{
u'_type': u'ratings', 
u'_source': {
            u'foo': u'fookey',
            u'bar': u'barvalue',
            u'fu': u'fuvalue',
            },
u'_index': u'fubar',
u'_version': 1,
u'found': True,
u'_id': u'fubarId'
}

I want to delete this index by passing the id "fubarId".Kindly provide me the query to delete it from Terminal

Note : I am using UJSON to store and retrieve


Solution

  • You can delete a single document using the Delete API:

    curl -XDELETE localhost:9200/index/type/docId
    

    In your case above, you would use this:

    curl -XDELETE localhost:9200/fubar/ratings/fubarId