Hi @ethranes,
another possibility is to use the experimental config option setup.template.append_fields in the APM Server config file to index additional fields. The advantage is that you don't need to manually reapply the changes on upgrades, as long as you have have this option configured.
Please note that from >= 7.0 on context.response.headers.* fields are stored as http.response.headers.* in Elasticsearch. Also note that the headers are canonicalized, e.g. content-type will be resolved to Content-Type.
More concrete, for indexing e.g. context.response.headers.content-type, you would update the apm-server.yml to include the following:
setup.template.enabled: true
setup.template.overwrite: true
setup.template.append_fields:
- name: http.response.headers
type: object
- name: http.response.headers.Content-Type
type: keyword
As @Eyal_Koren already pointed out all changes to templates are only applied for new indices.
Let us know if that works for you.