Update existing dataedit

This documentation refers to the standalone (legacy) method of running APM Server. This method of running APM Server will be deprecated and removed in a future release. Please consider upgrading to the Elastic APM integration. If you’ve already upgraded, please see Reduce storage instead.

You might want to update documents that are already indexed. For example, if you your service name was set incorrectly.

To do this, you can use the Update By Query API.

Rename a serviceedit

To rename a service, send the following request:

POST /apm-*/_update_by_query
  "query": {
    "term": {
      "service.name": {
        "value": "old-service-name"
  "script": {
    "source": "ctx._source.service.name = 'new-service-name'",
    "lang": "painless"

Remember to also change the service name in the APM agent configuration.