Update existing data

edit

You might want to update documents already ingested to Elasticsearch, e.g. if you your service name was set incorrectly, or you need to update a tag you have set.

You can update existing data by using the Update By Query API.

Rename a service

edit

For exampe, if you want to change the service name reported for your monitored data, you can do that by sending 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"
  }
}

Also check out how to change the service name for newly collected documents in the APM agent configuration accordingly.