# How to delete apm entries per service

**URL:** <https://discuss.elastic.co/t/how-to-delete-apm-entries-per-service/246550>\
**Category:** APM\
**Tags:** server\
**Created:** [August 27, 2020, 5:41am UTC](https://discuss.elastic.co/t/how-to-delete-apm-entries-per-service/246550 "2020-08-27T05:41:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![manohar\_deepu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manohar_deepu/32/72797_2.png) [@manohar\_deepu](https://discuss.elastic.co/u/manohar_deepu)\
**Post date:** [August 27, 2020, 5:41am UTC](https://discuss.elastic.co/t/how-to-delete-apm-entries-per-service/246550/1 "2020-08-27T05:41:27Z")

</div>

Hi,

I have a requirement where I don't want to delete all the entires of APM after certain date, rather I want to delete apm index entries per service level based on dates.

Is there lever from curator etc which helps me achieve this?

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [August 27, 2020, 6:31am UTC](https://discuss.elastic.co/t/how-to-delete-apm-entries-per-service/246550/2 "2020-08-27T06:31:40Z")

</div>

I think technically you _could_ do that with Curator, by using the Reindex action, but I don't think it would be the ideal approach.

Instead, I'd recommend that you:

- split events into service-specific indices (see [How to create index for each service?](https://discuss.elastic.co/t/how-to-create-index-for-each-service/242821))
- create service-specific ILM policies ([https://www.elastic.co/guide/en/apm/server/current/ilm.html#custom-ilm-policy](https://www.elastic.co/guide/en/apm/server/current/ilm.html#custom-ilm-policy))

---

<div class="post-metadata">

**Author:** ![manohar\_deepu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manohar_deepu/32/72797_2.png) [@manohar\_deepu](https://discuss.elastic.co/u/manohar_deepu)\
**Post date:** [August 27, 2020, 3:37pm UTC](https://discuss.elastic.co/t/how-to-delete-apm-entries-per-service/246550/3 "2020-08-27T15:37:12Z")

</div>

This was useful. Thanks!!

---

<div class="post-metadata">

**Author:** ![manohar\_deepu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manohar_deepu/32/72797_2.png) [@manohar\_deepu](https://discuss.elastic.co/u/manohar_deepu)\
**Post date:** [August 29, 2020, 3:12am UTC](https://discuss.elastic.co/t/how-to-delete-apm-entries-per-service/246550/4 "2020-08-29T03:12:36Z")

</div>

@axw

I need one more information, in the APM settings UI, there is Agent Configuration and Indices.

The Indices configuration suggests how APM UI queries and by default all are set ti "apm-\*"

How can make the APM UI also query specific to service? so that query via APM UI is also optimized.

 ![Screenshot 2020-08-29 at 8.41.51 AM](https://us1.discourse-cdn.com/elastic/original/3X/7/2/726734d1b0c56b27c2ff31fda78d68aeb8de2fae.png)

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [August 31, 2020, 7:28am UTC](https://discuss.elastic.co/t/how-to-delete-apm-entries-per-service/246550/5 "2020-08-31T07:28:33Z")

</div>

> [@manohar\_deepu](#):
>
> The Indices configuration suggests how APM UI queries and by default all are set ti "apm-\*"
> 
> How can make the APM UI also query specific to service? so that query via APM UI is also optimized.

The UI already queries per-service where applicable, by searching for `service.name: <service-name-in-context>`. This should already be quite fast. Are you observing performance issues in the UI, or is this more hypothetical?

There are some optimisations that can be made by hand, bu it's not something that we test or support out of the box: since you are separating indices by service, you could change the `service.name` field's type to [constant\_keyword](https://www.elastic.co/guide/en/elasticsearch/reference/current/constant-keyword.html). This would enable more efficient service-specific queries in Elasticsearch.

---

<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:** [September 21, 2020, 3:28am UTC](https://discuss.elastic.co/t/how-to-delete-apm-entries-per-service/246550/6 "2020-09-21T03:28:46Z")

</div>

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