# Elastic APM throws warning illegal\_argument\_exception with reason the number of source shards \[4\] must be a factor of \[30\]

**URL:** <https://discuss.elastic.co/t/elastic-apm-throws-warning-illegal-argument-exception-with-reason-the-number-of-source-shards-4-must-be-a-factor-of-30/223131>\
**Category:** APM\
**Tags:** server\
**Created:** [March 11, 2020, 12:43pm UTC](https://discuss.elastic.co/t/elastic-apm-throws-warning-illegal-argument-exception-with-reason-the-number-of-source-shards-4-must-be-a-factor-of-30/223131 "2020-03-11T12:43:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vipin\_Menon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vipin_menon/32/64229_2.png) [@Vipin\_Menon](https://discuss.elastic.co/u/Vipin_Menon)\
**Post date:** [March 11, 2020, 12:43pm UTC](https://discuss.elastic.co/t/elastic-apm-throws-warning-illegal-argument-exception-with-reason-the-number-of-source-shards-4-must-be-a-factor-of-30/223131/1 "2020-03-11T12:43:36Z")

</div>

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](http://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](http://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]"}

---

<div class="post-metadata">

**Author:** ![Bingu\_Shim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bingu_shim/32/57949_2.png) [@Bingu\_Shim](https://discuss.elastic.co/u/Bingu_Shim)\
**Post date:** [March 11, 2020, 3:23pm UTC](https://discuss.elastic.co/t/elastic-apm-throws-warning-illegal-argument-exception-with-reason-the-number-of-source-shards-4-must-be-a-factor-of-30/223131/2 "2020-03-11T15:23:07Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Vipin\_Menon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vipin_menon/32/64229_2.png) [@Vipin\_Menon](https://discuss.elastic.co/u/Vipin_Menon)\
**Post date:** [March 12, 2020, 7:38am UTC](https://discuss.elastic.co/t/elastic-apm-throws-warning-illegal-argument-exception-with-reason-the-number-of-source-shards-4-must-be-a-factor-of-30/223131/3 "2020-03-12T07:38:05Z")

</div>

Yes changing this fixed the issue 😀

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 2, 2020, 3:38am UTC](https://discuss.elastic.co/t/elastic-apm-throws-warning-illegal-argument-exception-with-reason-the-number-of-source-shards-4-must-be-a-factor-of-30/223131/4 "2020-04-02T03:38:08Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
