java.lang.String cannot be cast to java.util.Map while starting kibana 7.5.1

I enabled xpack security in Elasticsearch and it is working fine, I can able to do CRUD in elasticsearch using username/password. Now I downloaded kibana and enabled the following,

Blockquote
elasticsearch.hosts: ["http://localhost:9200"]
elasticsearch.username: "kibana"
elasticsearch.password: "elastic"
xpack.security.encryptionKey: "asdfghjklzxcvbnmqwertyuiopqwertyuiop"

But kibana failes to start and throwing the following in the console,

Blockquote log [09:19:38.209] [info][migrations] Creating index .kibana_task_manager_1.
log [09:19:38.220] [info][migrations] Creating index .kibana_1.
log [09:19:38.235] [warning][migrations] Unable to connect to Elasticsearch. Error: [class_cast_exception] java.lang.String cannot be cast to java.util.Map
log [09:19:38.237] [fatal][root] { Error: [class_cast_exception] java.lang.String cannot be cast to java.util.Map
at respond (c:\Arunan\tools\kibana-7.5.1-windows-x86_64\node_modules\elasticsearch\src\lib\transport.js:349:15)
at checkRespForFailure (c:\Arunan\tools\kibana-7.5.1-windows-x86_64\node_modules\elasticsearch\src\lib\transport.js:306:7)
at HttpConnector. (c:\Arunan\tools\kibana-7.5.1-windows-x86_64\node_modules\elasticsearch\src\lib\connectors\http.js:173:7)
at IncomingMessage.wrapper (c:\Arunan\tools\kibana-7.5.1-windows-x86_64\node_modules\elasticsearch\node_modules\lodash\lodash.js:4929:19)
at IncomingMessage.emit (events.js:194:15)
at endReadableNT (_stream_readable.js:1103:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
status: 500,
displayName: 'InternalServerError',
message:
'[class_cast_exception] java.lang.String cannot be cast to java.util.Map',
path: '/.kibana_task_manager_1',
query: {},
body:
{ error:
{ root_cause: [Array],
type: 'class_cast_exception',
reason: 'java.lang.String cannot be cast to java.util.Map' },
status: 500 },
statusCode: 500,
response:
'{"error":{"root_cause":[{"type":"class_cast_exception","reason":"java.lang.String cannot be cast to java.util.Map"}],"type":"class_cast_exception","reason":"java.lang.String cannot be cast to java.util.Map"},"status":500}',
toString: [Function],
toJSON: [Function] }
log [09:19:38.252] [info][plugins-system] Stopping all plugins.
log [09:19:38.257] [info][data][plugins] Stopping plugin
log [09:19:38.259] [info][plugins][translations] Stopping plugin
log [09:19:38.260] [info][plugins][spaces] Stopping plugin
log [09:19:38.262] [info][features][plugins] Stopping plugin
log [09:19:38.264] [info][plugins][timelion] Stopping plugin
log [09:19:38.265] [info][code][plugins] Stopping plugin
log [09:19:38.267] [info][licensing][plugins] Stopping plugin
log [09:19:38.274] [info][plugins][security] Stopping plugin

FATAL [class_cast_exception] java.lang.String cannot be cast to java.util.Map :: {"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":"java.lang.String cannot be cast to java.util.Map"}],"type":"class_cast_exception","reason":"java.lang.String cannot be cast to java.util.Map"},"status":500}"}

I am using windows 10.

Is your es username and password correct in kibana.yml?

This is a very strange error though. I am gonna ask somebody from dev team to take a look at this.

log [09:19:38.237] [fatal][root] { Error: [class_cast_exception] java.lang.String cannot be cast to java.util.Map

Thanks,
Bhavya

Yes it is correct.

@Arunan_Ramanathan what is the Elasticsearch version you are using? What are the .kibana* indices that you currently have?

@tiagocosta kibana version is 7.5.1 .. elastic search version is 6.8.4.. I don't understand the indices part.. where to check?

@Arunan_Ramanathan I think we could first start from here. We do not support running Kibana 7.x with Elasticsearch 6.x. Could you migrate the elasticsearch version to 7.5.1 ? You can find a guide here https://www.elastic.co/guide/en/elasticsearch/reference/current/rolling-upgrades.html

1 Like

I had similar issue..
But when I use elasticsearch v7.5.1 with kibana v6.8 ..It works fine. But I am not sure whether that's the correct way to solve this issue..

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