New

The executive guide to generative AI

Read more
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.

Update existing data

edit

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 service

edit

To rename a service, send the following request:

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

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

On this page

Was this helpful?
Feedback