0

I have sample data like below.

Data_id Name    Destination
224345565   HCM South VietNam
456566666   HN  North VietNam

 Index: Sample_1

sample_1 sample1

Data_id Food    Drink
224345565   Banh Mi Milk Coffee
456566666   Bun Cha Nuoc quac

 Index Sample_2

sample_2 sample2 I want to delete HCM name in first table and the data related with the same Data_id in Sample_2 also deleted. How can I do it? DELETE /sample_1, sample_2/_doc/224345565 ????

1 Answer 1

2

You can use delete by query API, to delete some specific documents (based on a condition) from multiple indexes.

POST /sample1,sample2/_delete_by_query
{
  "query": {
    "match": {
      "Data_id": 224345565
    }
  }
}
Sign up to request clarification or add additional context in comments.

6 Comments

@Josley please go through the answer, and let me know if this resolves your issue ?
Hi @ESCoder, I try with your answer, the data in sample2 was deleted but data in a sample is still exists!
@Josley have you added both the index in the post-call -> POST /sample1,sample2/_delete_by_query ? Because I tried it, and this query is working fine
@Josley can you please share the query which you are using along with the POST API call
Could you look through the new image in the post! The other example is about data in 2 different indexs.
|

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.