# Challenges embedding Kibana visualizations in elasticsearch \_site plugin

**URL:** https://discuss.elastic.co/t/challenges-embedding-kibana-visualizations-in-elasticsearch--site-plugin/24900
**Category:** Kibana
**Created:** [July 4, 2015, 8:01pm UTC](https://discuss.elastic.co/t/challenges-embedding-kibana-visualizations-in-elasticsearch--site-plugin/24900 "2015-07-04T20:01:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)
#### Post date: [July 4, 2015, 8:01pm UTC](https://discuss.elastic.co/t/challenges-embedding-kibana-visualizations-in-elasticsearch--site-plugin/24900/1 "2015-07-04T20:01:45Z")

</div>

I'm developing an elasticsearch \_site plugin that lets me create new indexes and upload content.

I can embed Kibana visualizations in an iFrame to good effect but came across 2 issues:

1. Chrome is happy embedding Kibana iFrames that render data but Safari iFrames have dashboards with this error: "Blocked a frame with origin "[http://localhost:5601](http://localhost:5601)" from accessing a frame with origin "[http://localhost:9200](http://localhost:9200)". Protocols, domains, and ports must match". So that's a 9200-served page loading a 5601-served iFrame that then fails to call a 9200 REST endpoint.
2. If I change the index mapping/content and add a new field "Foo" I need a way to force Kibana to refresh field definitions or I can't embed a visualization for Foo's values. Is there an API I can call to trigger this refresh?

Cheers  
Mark

---

<div class="post-metadata">

### Author: ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)
#### Post date: [July 4, 2015, 9:14pm UTC](https://discuss.elastic.co/t/challenges-embedding-kibana-visualizations-in-elasticsearch--site-plugin/24900/2 "2015-07-04T21:14:38Z")

</div>

Replying to self: I figured out the CORS setting to solve 1) and by observing the kibana browser/server traffic I can see how to send a revised set of field definitions from the browser to solve 2). Feels a bit hacky but it works.

---

<div class="post-metadata">

### Author: ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)
#### Post date: [July 6, 2015, 3:27am UTC](https://discuss.elastic.co/t/challenges-embedding-kibana-visualizations-in-elasticsearch--site-plugin/24900/3 "2015-07-06T03:27:09Z")

</div>

@Mark_Harwood If you were running code within Kibana you could simply call the `indexPattern.refreshFields()` method and the field list would be rebuild. Not sure I can imagine a better way to expose this, short of moving this logic to the server and exposing a REST API (a solution we plan to implement someday).

---

<div class="post-metadata">

### Author: ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)
#### Post date: [July 6, 2015, 8:54am UTC](https://discuss.elastic.co/t/challenges-embedding-kibana-visualizations-in-elasticsearch--site-plugin/24900/4 "2015-07-06T08:54:44Z")

</div>

> If you were running code within Kibana

No, it's a \_site plugin doing it's own thing and just embedding the odd kibana pie-chart here or there. Index deletion, creation and content uploading are part of the tool's function for a variety of doc types and so I need to keep kibana server updated with these changes.  
A REST endpoint would make a lot of sense in this context where the usual "kibana experience" is not required and I just need to embed some piecharts etc.

---

<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: [July 6, 2017, 2:17pm UTC](https://discuss.elastic.co/t/challenges-embedding-kibana-visualizations-in-elasticsearch--site-plugin/24900/5 "2017-07-06T14:17:03Z")

</div>


