Elastic APM throws warning illegal_argument_exception with reason the number of source shards [4] must be a factor of [30]

I get the error

when I run the command

docker run --rm -it --name=apm-server --user=apm-server --volume="$(pwd)/apm-server.docker.yml:/usr/share/apm-server/apm-server.yml:ro" -p 8200:8200 docker.elastic.co/apm/apm-server-oss:7.3.2 --strict.perms=false -E "apm-server.jaeger.http.enabled=true" -E "output.elasticsearch.pipeline=_none" -E "apm-server.monitoring.enabled=false" -e

Elasticsearch version: 7.3.2

APM Server version: 7.3.2

Original install method (e.g. download page, yum, deb, from source, etc.) and version: docker.elastic.co/apm/apm-server-oss:7.3.2

Fresh install or upgraded from other version?

Is there anything special in your setup? Using Elasticsearch OpenDistro as backend

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant): Kibana Still Shows -> APM Server has still not connected to Elasticsearch

Provide logs and/or server output (if relevant):

elasticsearch/client.go:535 Cannot index event publisher.Event{Content:beat.Event{Timestamp:time.Time{wall:0xbf92548795b4890c, ext:58875614, loc:(*time.Location)(0x2714fc0)}, Meta:common.MapStr(nil), Fields:common.MapStr{"ecs":common.MapStr{"version":"1.0.1"}, "observer":common.MapStr{"ephemeral_id":"bcd15af2-686b-47ee-91cf-3f23bab8575f", "hostname":"e90187f40685", "id":"2e4f90d0-e663-4108-a513-ee86cfecd04f", "listening":"[::]:8200", "type":"apm-server", "version":"7.3.2", "version_major":7}, "processor":common.MapStr{"event":"onboarding", "name":"onboarding"}}, Private:interface {}(nil), TimeSeries:false}, Flags:0x1} (status=400): {"type":"illegal_argument_exception","reason":"the number of source shards [4] must be a factor of [30]"}

Try changing 'number_of_shards' value from 4 to 5

It's because of the 'number_of_shards'
The error message said, you set number_of_shards value as '4' which is not a factor of 30 (default number_of_routing_shards)

1 Like

Yes changing this fixed the issue :grinning:

1 Like