elasticsearch, logstash, kibana: 7.17.3
apm-server: 7.5.2
I am getting the following error when trying to access the APM tab on Kibana:

Error while fetching resource
search_phase_execution_exception: [illegal_argument_exception] Reason: Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [service.name] in order to load field data by uninverting the inverted index. Note that this can use significant memory. (500)
This seems similar to the question here but I don't have any of the setup process in apm-server.yml as I am writing directly to kafka (not elasticsearch) and ilm setup is all taken care by logstash (see below).
Background:
I am using apm-server to output to a kafka topic named apm-server and I have logstash consume said kafka topic and output to elasticsearch.
apm-server config:
# ensure only kafka output
output.file:
enabled: false
output.console:
enabled: false
output.kafka:
hosts: ["kafka-bootstrap.kafka:9092"]
topic: apm-server
key: '%{[processor.event,service.name,kubernetes.pod.uid]:default}'
partition.hash:
hash:
- processor.event
- service.name
- kubernetes.pod.uid
random: true
compression: lz4
output piece of logstash pipeline:
output {
elasticsearch {
hosts => ["https://elastic-stack-coordinator:9200"]
ssl => true
keystore => <REDACTED>
keystore_password => <REDACTED>
truststore => <REDACTED>
truststore_password => <REDACTED>
manage_template => false
user => apm_writer
password => <REDACTED>
index => "apm-index"
ilm_rollover_alias => "apm-index"
ilm_pattern => "000001"
ilm_policy => "apm-ilm"
ilm_enabled => true
}
}
so when my ELK cluster starts, I end up with an index named apm-index-000001 with ilm_rollover_alias apm-index.
This all works fine in dev (identical settings as test cluster) and prod clusters but does not in a third cluster I just setup.
