# Unknown key 'elasticsearch.hosts' for Kibana plugin config

**URL:** <https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254>\
**Category:** Kibana\
**Created:** [December 10, 2019, 9:18am UTC](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254 "2019-12-10T09:18:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elaak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elaak/32/55014_2.png) [@Elaak](https://discuss.elastic.co/u/Elaak)\
**Post date:** [December 10, 2019, 9:18am UTC](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254/1 "2019-12-10T09:18:07Z")

</div>

Continuing the discussion from [Retrieve elasticsearch.hosts from Kibana config in plugin](https://discuss.elastic.co/t/retrieve-elasticsearch-hosts-from-kibana-config-in-plugin/202152/2):

I am using Elastic stack 7.4.2 and I am having this simple issue with just getting the configured elasticsearch hosts. It should not be more difficult than

```
server.config().get('elasticsearch.hosts')

```

but I get the error `"Unknown config key: elasticsearch.hosts"`. When I do a `console.log` of my config, I see that `elasticsearch` only has one key: `enabled: true`. Why is it that the configuration is not accessible?

In my `kibana.yml` I have `elasticsearch.hosts: ['http://localhost:9299']` configured and kibana receives data, so the configuration itself must be correct.

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [December 11, 2019, 11:21am UTC](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254/2 "2019-12-11T11:21:56Z")

</div>

Hi @Elaak,

Well, Kibana is in a process of migration to a so called new platform. And this config is no longer a part of the plugin contract (APIs that custom plugins have access to). Currently you can still access it through BWC hook, but there is no guarantee that it will be available in 8.0:

```javascript
const legacyEsConfig = await server.newPlatform.__internals.elasticsearch.legacy.config$
        .pipe(first())
        .toPromise();
const hosts = legacyEsConfig.hosts;

```

May I ask you why you need to access this value? Also maybe it's a good time for you to start writing "New Platform" plugins (assuming the new platform provides you with all necessary APIs already, see examples [here](https://github.com/elastic/kibana/tree/master/src/plugins) and [here](https://github.com/elastic/kibana/tree/master/x-pack/plugins)).

Best,  
Oleg

---

<div class="post-metadata">

**Author:** ![Elaak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elaak/32/55014_2.png) [@Elaak](https://discuss.elastic.co/u/Elaak)\
**Post date:** [December 11, 2019, 12:50pm UTC](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254/3 "2019-12-11T12:50:01Z")

</div>

Hi @azasypkin,

Thank you for the quick answer.

This morning I found out about the elasticsearch client that I can implement in Kibana instead. The plan was otherwise to make a call to the elasticsearch API for my task, but I tested your solution in case I in the future need to access other values from this config.

Currently we have decided to stay at version 7.4 for our setup so the plugin has to be developed for that version.

---

<div class="post-metadata">

**Author:** ![Elaak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elaak/32/55014_2.png) [@Elaak](https://discuss.elastic.co/u/Elaak)\
**Post date:** [December 11, 2019, 12:50pm UTC](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254/4 "2019-12-11T12:50:41Z")

</div>

Thank you for the quick answer.

This morning I found out about the elasticsearch client that I can implement in Kibana instead. The plan was otherwise to make a call to the elasticsearch API for my task, but I tested your solution in case I in the future need to access other values from this config.

Currently we have decided to stay at version 7.4 for our setup so the plugin has to be developed for that version.

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [December 11, 2019, 2:15pm UTC](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254/5 "2019-12-11T14:15:27Z")

</div>

> [@Elaak](#):
>
> This morning I found out about the elasticsearch client that I can implement in Kibana instead. The plan was otherwise to make a call to the elasticsearch API for my task, but I tested your solution in case I in the future need to access other values from this config.

👍

> Currently we have decided to stay at version 7.4 for our setup so the plugin has to be developed for that version.

Sure, just wanted to note that new platform plugins are already supported in 7.4 as well, it's just an amount of APIs that are available is limited and constantly increasing. The plan is to support new platform plugins only since 8.0 - so make sure to allocate some time to migrate before next major version upgrade.

---

<div class="post-metadata">

**Author:** ![Elaak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elaak/32/55014_2.png) [@Elaak](https://discuss.elastic.co/u/Elaak)\
**Post date:** [December 13, 2019, 8:29am UTC](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254/6 "2019-12-13T08:29:50Z")

</div>

> [@azasypkin](#):
>
> Sure, just wanted to note that new platform plugins are already supported in 7.4 as well, it's just an amount of APIs that are available is limited and constantly increasing. The plan is to support new platform plugins only since 8.0 - so make sure to allocate some time to migrate before next major version upgrade.

Thanks, I will keep that in mind for the ongoing development next year.

---

<div class="post-metadata">

**Author:** ![Inno\_Park](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inno_park/32/50997_2.png) [@Inno\_Park](https://discuss.elastic.co/u/Inno_Park)\
**Post date:** [December 20, 2019, 10:08am UTC](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254/7 "2019-12-20T10:08:15Z")

</div>

Hi @Elaak @azasypkin  
I did not get the solution here.  
I am using Kibana 7.4.2, and I have properly configured kibana.yml and I get the same error while starting the service.  
I am using the kibana\_own\_home plugin.  
Could you please explain what exactly I am supposed to do to get over the error ?  
I am stuck !!

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [December 20, 2019, 10:21am UTC](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254/8 "2019-12-20T10:21:57Z")

</div>

Hey @Inno_Park,

Do you also use `server.config().get('elasticsearch.hosts')` in your plugin? If not, then please create a new thread to avoid mixing two unrelated issues.

Best,  
Oleg

---

<div class="post-metadata">

**Author:** ![Inno\_Park](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inno_park/32/50997_2.png) [@Inno\_Park](https://discuss.elastic.co/u/Inno_Park)\
**Post date:** [December 20, 2019, 10:55am UTC](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254/9 "2019-12-20T10:55:44Z")

</div>

yes thats what we use

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [December 20, 2019, 11:26am UTC](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254/10 "2019-12-20T11:26:11Z")

</div>

> [@Inno\_Park](#):
>
> yes thats what we use

So, then just use suggestion from [Unknown key 'elasticsearch.hosts' for Kibana plugin config - #2 by azasypkin](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254/2). Or it doesn't work for you for some reason?

---

<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 17, 2020, 11:26am UTC](https://discuss.elastic.co/t/unknown-key-elasticsearch-hosts-for-kibana-plugin-config/211254/11 "2020-01-17T11:26:15Z")

</div>

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