# How can I remove a service?

**URL:** <https://discuss.elastic.co/t/how-can-i-remove-a-service/136904>\
**Category:** APM\
**Created:** [June 21, 2018, 3:00pm UTC](https://discuss.elastic.co/t/how-can-i-remove-a-service/136904 "2018-06-21T15:00:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arisbanach](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@arisbanach](https://discuss.elastic.co/u/arisbanach)\
**Post date:** [June 21, 2018, 3:00pm UTC](https://discuss.elastic.co/t/how-can-i-remove-a-service/136904/1 "2018-06-21T15:00:51Z")

</div>

I renamed a service and now I have the new name and the old name. How can I remove the old service name?

---

<div class="post-metadata">

**Author:** ![sqren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sqren/32/26110_2.png) [@sqren](https://discuss.elastic.co/u/sqren)\
**Post date:** [June 21, 2018, 3:46pm UTC](https://discuss.elastic.co/t/how-can-i-remove-a-service/136904/2 "2018-06-21T15:46:47Z")

</div>

Hi Arisbanach,

To get rid of the offending documents you will either have to update the `context.service.name` value for all of them, or delete them.

The simplest way to delete the documents is with a query like this:

```auto
GET apm*/_delete_by_query
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "context.service.name": "old-service-name"
          }
        }
      ]
    }
  }
}

```

Let me know if you have any other questions.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 12, 2018, 11:46am UTC](https://discuss.elastic.co/t/how-can-i-remove-a-service/136904/3 "2018-07-12T11:46:57Z")

</div>

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