0

I'm new to Elasticsearch, and I cannot find a Delete query.

Here is an example of an document in myIndex :

{
  "_index": "myIndex",
  "_type": "_doc",
  "_id": "IPc5kn8Bq7SuVr5qM9dq",
  "_score": 1,
  "_source": {
    "code": "1234567",
    "matches": [
      {
        "hostname": "hostnameA.com",
        "url": "https://www.hostnameA.com/....",
      },
      {
        "hostname": "hostnameB.com",
        "url": "https://www.hostnameB.com/....",
      },
      {
        "hostname": "hostnameC.com",
        "url": "https://www.hostnameC.com/....",
      },
      {
        "hostname": "hostnameD.com",
        "url": "https://www.hostnameD.com/....",
      },
    ]
  }
}

Let's say this index contains 10k documents.

I would like a query to remove all the item from my array matches where the hostname is equal to hostnameC.com, and keeping all the others.

Anyone would have an idea to help me?

2
  • Duplicate of: stackoverflow.com/questions/49384199/… Commented Jun 23, 2022 at 15:20
  • As mentioned above, you will succeed if you reproduce the suggestion. Don't forget to match like this: ctx._source['matches'][i].hostname == 'hostnameC.com' Commented Jun 23, 2022 at 15:40

0

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.