Delete documents

Hi, I am kinda confused about the operation of deleting in ES.

If I import a json file which contains several items to ES thru logstash, also specify the index as "sampledata". Later on, I wanted to delete what I imported in ES. So I just did "delete /sampledata", the whole index was removed. But when I imported another file that has the same index as "sampledata", the old documents showed up when I search all the items in that index. So now, the index contains all new and old data which is supposed to be removed from ES.

All I want to do is to actually remove what I import.

If the index was removed and the documents are showing up, it'll be because they are being reimported.

1 Like

Let's say I imported one json file called "test_data.json" that only contained one item {"name" : "David", "age" : 12}. And then I removed the whole index in ES for that item. Later on, I cleared the same json file and put one new item {"Alice" : 10} on it and imported it to ES(same index as before). Then "David" still showed up in the index.

It might help if you post the code that you are using for this, including sample documents.

1 Like

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