# Error 500 on kibana startup - Unable to connect to Elasticsearch

**URL:** <https://discuss.elastic.co/t/error-500-on-kibana-startup-unable-to-connect-to-elasticsearch/211782>\
**Category:** Kibana\
**Created:** [December 13, 2019, 11:26am UTC](https://discuss.elastic.co/t/error-500-on-kibana-startup-unable-to-connect-to-elasticsearch/211782 "2019-12-13T11:26:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sezio](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@sezio](https://discuss.elastic.co/u/sezio)\
**Post date:** [December 13, 2019, 11:26am UTC](https://discuss.elastic.co/t/error-500-on-kibana-startup-unable-to-connect-to-elasticsearch/211782/1 "2019-12-13T11:26:58Z")

</div>

Hello,

I've not been able to find a similar problem or a working answer so I'm opening a new topic.  
I've installed Kibana through the apt repository to see what happens in my elastic search database. I've been using ES for a while now and it's working fine on a magento 2 website.

When I try to start Kibana by sudo `/etc/init.d/kibana` start I have the following error in my kibana stderr log file :

`FATAL [class_cast_exception] class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap') :: {"path":"/.kibana_task_manager_1","query":{},"body":"{\"mappings\":{\"dynamic\":\"strict\",\"properties\":{\"config\":{\"dynamic\":\"true\",\"properties\":{\"buildNum\":{\"type\":\"keyword\"}}},\"migrationVersion\":{\"dynamic\":\"true\",\"type\":\"object\"},\"type\":{\"type\":\"keyword\"},\"namespace\":{\"type\":\"keyword\"},\"updated_at\":{\"type\":\"date\"},\"references\":{\"type\":\"nested\",\"properties\":{\"name\":{\"type\":\"keyword\"},\"type\":{\"type\":\"keyword\"},\"id\":{\"type\":\"keyword\"}}},\"task\":{\"properties\":{\"taskType\":{\"type\":\"keyword\"},\"scheduledAt\":{\"type\":\"date\"},\"runAt\":{\"type\":\"date\"},\"startedAt\":{\"type\":\"date\"},\"retryAt\":{\"type\":\"date\"},\"interval\":{\"type\":\"text\"},\"attempts\":{\"type\":\"integer\"},\"status\":{\"type\":\"keyword\"},\"params\":{\"type\":\"text\"},\"state\":{\"type\":\"text\"},\"user\":{\"type\":\"keyword\"},\"scope\":{\"type\":\"keyword\"},\"ownerId\":{\"type\":\"keyword\"}}}},\"_meta\":{\"migrationMappingPropertyHashes\":{\"config\":\"87aca8fdb053154f11383fce3dbf3edf\",\"migrationVersion\":\"4a1746014a75ade3a714e1db5763276f\",\"type\":\"2f4316de49999235636386fe51dc06c1\",\"namespace\":\"2f4316de49999235636386fe51dc06c1\",\"updated_at\":\"00da57df13e94e9d98437d13ace4bfe0\",\"references\":\"7997cf5a56cc02bdc9c93361bde732b0\",\"task\":\"a7206eba37aaea59ba083a079fd80b65\"}}},\"settings\":{\"number_of_shards\":1,\"auto_expand_replicas\":\"0-1\"}}","statusCode":500,"response":"{\"error\":{\"root_cause\":[{\"type\":\"class_cast_exception\",\"reason\":\"class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap')\"}],\"type\":\"class_cast_exception\",\"reason\":\"class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap')\"},\"status\":500}"}`

Elastic search is up as you can see :  
`/usr/share/kibana$ ps aux | grep -i elas sebasti+ 8545 2.6 9.9 9193528 1618584 pts/3 Sl 10:51 2:11 /bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch-2859441201120843636 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m -Djava.locale.providers=COMPAT -XX:UseAVX=2 -Des.path.home=/opt/elasticsearch/elasticsearch-6.8.3 -Des.path.conf=/opt/elasticsearch/elasticsearch-6.8.3/config -Des.distribution.flavor=default -Des.distribution.type=tar -cp /opt/elasticsearch/elasticsearch-6.8.3/lib/* org.elasticsearch.bootstrap.Elasticsearch -d`

By enabling the verbose log, I also have the following more detailed exception :  
`{"type":"log","@timestamp":"2019-12-13T11:05:21Z","tags":["debug","elasticsearch","admin","query"],"pid":17351,"message":"500\nPUT /.kibana_task_manager_1\n{\"mappings\":{\"dynamic\":\"strict\",\"properties\":{\"config\":{\"dynamic\":\"true\",\"properties\":{\"buildNum\":{\"type\":\"keyword\"}}},\"migrationVersion\":{\"dynamic\":\"true\",\"type\":\"object\"},\"type\":{\"type\":\"keyword\"},\"namespace\":{\"type\":\"keyword\"},\"updated_at\":{\"type\":\"date\"},\"references\":{\"type\":\"nested\",\"properties\":{\"name\":{\"type\":\"keyword\"},\"type\":{\"type\":\"keyword\"},\"id\":{\"type\":\"keyword\"}}},\"task\":{\"properties\":{\"taskType\":{\"type\":\"keyword\"},\"scheduledAt\":{\"type\":\"date\"},\"runAt\":{\"type\":\"date\"},\"startedAt\":{\"type\":\"date\"},\"retryAt\":{\"type\":\"date\"},\"interval\":{\"type\":\"text\"},\"attempts\":{\"type\":\"integer\"},\"status\":{\"type\":\"keyword\"},\"params\":{\"type\":\"text\"},\"state\":{\"type\":\"text\"},\"user\":{\"type\":\"keyword\"},\"scope\":{\"type\":\"keyword\"},\"ownerId\":{\"type\":\"keyword\"}}}},\"_meta\":{\"migrationMappingPropertyHashes\":{\"config\":\"87aca8fdb053154f11383fce3dbf3edf\",\"migrationVersion\":\"4a1746014a75ade3a714e1db5763276f\",\"type\":\"2f4316de49999235636386fe51dc06c1\",\"namespace\":\"2f4316de49999235636386fe51dc06c1\",\"updated_at\":\"00da57df13e94e9d98437d13ace4bfe0\",\"references\":\"7997cf5a56cc02bdc9c93361bde732b0\",\"task\":\"a7206eba37aaea59ba083a079fd80b65\"}}},\"settings\":{\"number_of_shards\":1,\"auto_expand_replicas\":\"0-1\"}}"}`

Configuration file is the default one in `/etc/kibana/config.yml`, except for the two debug rows :  
`elasticsearch.logQueries: true`  
`logging.verbose: true`

A curl request on ES returns the json :  
`/usr/share/kibana$ curl "127.0.0.1:9200/_nodes/settings?pretty=true" { "_nodes" : { "total" : 1, "successful" : 1, "failed" : 0 }, "cluster_name" : "elastic_cluster1", "nodes" : { "hmNYtPd2S7SGBIJp7YJBEw" : { "name" : "node-2", "transport_address" : "127.0.0.1:9300", "host" : "localhost", "ip" : "127.0.0.1", "version" : "6.8.3", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "0c48c0e", "roles" : ["master", "data", "ingest"], "attributes" : { "ml.machine_memory" : "16578093056", "xpack.installed" : "true", "ml.max_open_jobs" : "20", "ml.enabled" : "true" }, "settings" : { "cluster" : { "name" : "elastic_cluster1" }, "node" : { "attr" : { "xpack" : { "installed" : "true" }, "ml" : { "machine_memory" : "16578093056", "max_open_jobs" : "20", "enabled" : "true" } }, "data" : "true", "name" : "node-2" }, "path" : { "logs" : "/opt/elasticsearch/elasticsearch-6.8.3/logs", "home" : "/opt/elasticsearch/elasticsearch-6.8.3" }, "client" : { "type" : "node" }, "http" : { "type" : "security4", "port" : "9200", "type.default" : "netty4" }, "transport" : { "host" : "localhost", "tcp" : { "port" : "9300" }, "features" : { "x-pack" : "true" }, "type" : "security4", "type.default" : "netty4" }, "network" : { "host" : "0.0.0.0" } } } } }`

I've no password set up on my ES instance  
As you can see in the curl request I'm using http and not https  
I'm using debian buster up to date  
java version :  
`/usr/share/kibana$ java --version openjdk 11.0.5 2019-10-15 OpenJDK Runtime Environment (build 11.0.5+10-post-Debian-1deb10u1) OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Debian-1deb10u1, mixed mode, sharing)`

Maybe I've missed something but I'm not even able to start kibana and I have no clue of what is going on.

Have you any idea of something I could be doing wrong ??

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![sezio](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@sezio](https://discuss.elastic.co/u/sezio)\
**Post date:** [December 13, 2019, 11:28am UTC](https://discuss.elastic.co/t/error-500-on-kibana-startup-unable-to-connect-to-elasticsearch/211782/2 "2019-12-13T11:28:42Z")

</div>

Also, I have a similar exception in my running instance of elastic search :

`[2019-12-13T12:23:05,984][WARN][r.suppressed] [node-2] path: /.kibana_task_manager_1, params: {index=.kibana_task_manager_1} java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap') at org.elasticsearch.action.admin.indices.create.CreateIndexRequest.source(CreateIndexRequest.java:391) ~[elasticsearch-6.8.3.jar:6.8.3] at org.elasticsearch.rest.action.admin.indices.RestCreateIndexAction.prepareRequest(RestCreateIndexAction.java:71) ~[elasticsearch-6.8.3.jar:6.8.3] at org.elasticsearch.rest.BaseRestHandler.handleRequest(BaseRestHandler.java:91) ~[elasticsearch-6.8.3.jar:6.8.3] at org.elasticsearch.xpack.security.rest.SecurityRestFilter.handleRequest(SecurityRestFilter.java:87) ~[?:?] at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:240) [elasticsearch-6.8.3.jar:6.8.3] at org.elasticsearch.rest.RestController.tryAllHandlers(RestController.java:336) [elasticsearch-6.8.3.jar:6.8.3] at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:174) [elasticsearch-6.8.3.jar:6.8.3]`  
.......  
`[2019-12-13T12:23:05,995][WARN][r.suppressed] [node-2] path: /.kibana_1, params: {index=.kibana_1} java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap') at org.elasticsearch.action.admin.indices.create.CreateIndexRequest.source(CreateIndexRequest.java:391) ~[elasticsearch-6.8.3.jar:6.8.3] at org.elasticsearch.rest.action.admin.indices.RestCreateIndexAction.prepareRequest(RestCreateIndexAction.java:71) ~[elasticsearch-6.8.3.jar:6.8.3] at org.elasticsearch.rest.BaseRestHandler.handleRequest(BaseRestHandler.java:91) ~[elasticsearch-6.8.3.jar:6.8.3] at org.elasticsearch.xpack.security.rest.SecurityRestFilter.handleRequest(SecurityRestFilter.java:87) ~[?:?] at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:240) [elasticsearch-6.8.3.jar:6.8.3] at org.elasticsearch.rest.RestController.tryAllHandlers(RestController.java:336) [elasticsearch-6.8.3.jar:6.8.3] at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:174) [elasticsearch-6.8.3.jar:6.8.3]`  
......  
`[2019-12-13T12:23:06,016][WARN][o.e.h.n.Netty4HttpServerTransport] [node-2] caught exception while handling client http traffic, closing connection [id: 0xd683fb47, L:/127.0.0.1:9200 - R:/127.0.0.1:44372] java.io.IOException: Connexion ré-initialisée par le correspondant at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?] at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[?:?] at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276) ~[?:?] at sun.nio.ch.IOUtil.read(IOUtil.java:245) ~[?:?] at sun.nio.ch.IOUtil.read(IOUtil.java:223) ~[?:?] at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358) ~[?:?] at io.netty.buffer.PooledHeapByteBuf.setBytes(PooledHeapByteBuf.java:261) ~[netty-buffer-4.1.32.Final.jar:4.1.32.Final] `

Again, thanks for your help !

---

<div class="post-metadata">

**Author:** ![lkravi](https://avatars.discourse-cdn.com/v4/letter/l/f6c823/32.png) [@lkravi](https://discuss.elastic.co/u/lkravi)\
**Post date:** [December 15, 2019, 3:21pm UTC](https://discuss.elastic.co/t/error-500-on-kibana-startup-unable-to-connect-to-elasticsearch/211782/3 "2019-12-15T15:21:06Z")

</div>

I'm experiencing same issue. I just try to newly set up elk. elastsearch is up and running. when i try to start kibana I can see same error. I'm using default elastisearch and kibana configurations.

 ![elastisearch](https://us1.discourse-cdn.com/elastic/original/3X/0/b/0b61bc1ac44e9c2a2e2a050392e8669936b89a5a.png)

---

<div class="post-metadata">

**Author:** ![sezio](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@sezio](https://discuss.elastic.co/u/sezio)\
**Post date:** [December 23, 2019, 8:43am UTC](https://discuss.elastic.co/t/error-500-on-kibana-startup-unable-to-connect-to-elasticsearch/211782/4 "2019-12-23T08:43:14Z")

</div>

Hi,

I uninstalled Kibana, reinstalled it from the repository and tried to update the config but nothing works.  
Does somebody have any suggestion ?

Thanks!

---

<div class="post-metadata">

**Author:** ![mdaftab88](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mdaftab88/32/59955_2.png) [@mdaftab88](https://discuss.elastic.co/u/mdaftab88)\
**Post date:** [December 25, 2019, 8:10am UTC](https://discuss.elastic.co/t/error-500-on-kibana-startup-unable-to-connect-to-elasticsearch/211782/5 "2019-12-25T08:10:48Z")

</div>

I am struggling with same issue.

I am facing this issue on mac.  
elasticsearch version: `Version: 6.8.1, Build: oss/tar/1fad4e1/2019-06-18T13:16:52.517138Z, JVM: 1.8.0_212`

kibana version: `7.5.1 Build: oss`

---

<div class="post-metadata">

**Author:** ![siddharaj.nayak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siddharaj.nayak/32/60018_2.png) [@siddharaj.nayak](https://discuss.elastic.co/u/siddharaj.nayak)\
**Post date:** [December 27, 2019, 7:23am UTC](https://discuss.elastic.co/t/error-500-on-kibana-startup-unable-to-connect-to-elasticsearch/211782/6 "2019-12-27T07:23:18Z")

</div>

I was facing the same issue. I tried with closest matching version of kibana to that of elastic search. it worked for me! e.g. for elasticssearch v6.8.1 try kibana v6.8.\* instead of kibana v 7.5.1.

---

<div class="post-metadata">

**Author:** ![rameshkr1994](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rameshkr1994/32/59029_2.png) [@rameshkr1994](https://discuss.elastic.co/u/rameshkr1994)\
**Post date:** [December 27, 2019, 7:47am UTC](https://discuss.elastic.co/t/error-500-on-kibana-startup-unable-to-connect-to-elasticsearch/211782/7 "2019-12-27T07:47:28Z")

</div>

Hi @siddharaj.nayak and @lkravi.

`you can achieve it in very simple manner `

> for access index of ES through Kibana you need to focus on Version compatibility with both kibana and ES.  
> and for more you need to map your Elasticsearch host machine with kibana.yml

> if you still facing the issue please share kibana.yml file here?

Thanks  
HadoopHelp

---

<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:** [January 24, 2020, 7:47am UTC](https://discuss.elastic.co/t/error-500-on-kibana-startup-unable-to-connect-to-elasticsearch/211782/8 "2020-01-24T07:47:37Z")

</div>

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