# How to create a dynamic url for kibana discover

**URL:** <https://discuss.elastic.co/t/how-to-create-a-dynamic-url-for-kibana-discover/204152>\
**Category:** Kibana\
**Created:** [October 18, 2019, 1:52am UTC](https://discuss.elastic.co/t/how-to-create-a-dynamic-url-for-kibana-discover/204152 "2019-10-18T01:52:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rockyadi](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@rockyadi](https://discuss.elastic.co/u/rockyadi)\
**Post date:** [October 18, 2019, 1:52am UTC](https://discuss.elastic.co/t/how-to-create-a-dynamic-url-for-kibana-discover/204152/1 "2019-10-18T01:52:49Z")

</div>

Hi we have a daily report we publish in which we would like to provide a **dynamic** link (URL) to kibana with a dynamic search term **string query** say "Error Fetching, Shipping Details" and in a particular dynamic time frame say "from:10/18/2019 to 10/17/2019" on a particular search index "app-metric-\*"

followed this answer [Generating a url that contains a query](https://discuss.elastic.co/t/generating-a-url-that-contains-a-query/159134)

the answer is not an exact match to our requirement as the answer has key: params: style where as mine is a simple string query and time in the answer is now -24h where as we would like it to be particular dates with time say from 10/18/2019:6:00 to 10/17/209:6:0:0

and tried to create a url like this,

[http://localhost:5601/app/kibana#/discover?\_g=(refreshInterval:(pause:!t,value:0),time:(from:now-24h,mode:quick,to:now)](http://localhost:5601/app/kibana#/discover?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-24h,mode:quick,to:now)))&\_a=(columns:!(\_source),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:app-metric-events-_,negate:!f,params:(query:"Error Fetching Shipping ,Details",type:phrase),type:phrase,value:"Error Fetching, Shipping Details"),query:(match:(query:"Error Fetching, Shipping Details",type:phrase)))),index:app-metric-events-_,interval:auto,query:(language:lucene,query:''),sort:!(timestamp,desc))

**when i paste in the browser it is redirecting to kibana site (No search term is populated, index is not populated, timeframe is not populated)** but on the site we are getting **"url parse exception"** model but it's not specific to which part failed, we are fairly new to kibana appreciate the community help in resolving the issue please.

Thanks

---

<div class="post-metadata">

**Author:** ![matw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matw/32/13913_2.png) [@matw](https://discuss.elastic.co/u/matw)\
**Post date:** [October 18, 2019, 9:04am UTC](https://discuss.elastic.co/t/how-to-create-a-dynamic-url-for-kibana-discover/204152/2 "2019-10-18T09:04:59Z")

</div>

Hi & Welcome to the Kibana community! 👋

So here's a similar query I did in Discover

`http://localhost:5601/app/kibana#/discover?_g=(refreshInterval:(pause:!t,value:0),time:(from:'2019-10-16T06:00',to:'2019-10-18T06:00'))&_a=(columns:!(_source),index:'logstash-*',interval:auto,query:(language:lucene,query:'Error%20Fetching,%20Shipping%20Details'),sort:!(!('@timestamp',desc)))`

you could adapt it for your use case, replace **from** and **to** ( (formatted like in the example)), **index** , and in **query** replace/encode spaces with **%20**

Then it should work

---

<div class="post-metadata">

**Author:** ![rockyadi](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@rockyadi](https://discuss.elastic.co/u/rockyadi)\
**Post date:** [October 19, 2019, 7:22pm UTC](https://discuss.elastic.co/t/how-to-create-a-dynamic-url-for-kibana-discover/204152/3 "2019-10-19T19:22:25Z")

</div>

Thank you very much @matw you are a life saver! 👍

---

<div class="post-metadata">

**Author:** ![rockyadi](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@rockyadi](https://discuss.elastic.co/u/rockyadi)\
**Post date:** [October 19, 2019, 10:28pm UTC](https://discuss.elastic.co/t/how-to-create-a-dynamic-url-for-kibana-discover/204152/4 "2019-10-19T22:28:01Z")

</div>

@matw the solution you shared seem to work for all the fields where it is populating the search term and time filter but it's not populating the index 'logstash-_' \*\*getting the error 'logstash-_' is not a default index\*\* "even though an index by the name logstash-\* exists any thoughts on it will be of great help

---

<div class="post-metadata">

**Author:** ![matw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matw/32/13913_2.png) [@matw](https://discuss.elastic.co/u/matw)\
**Post date:** [October 21, 2019, 10:49am UTC](https://discuss.elastic.co/t/how-to-create-a-dynamic-url-for-kibana-discover/204152/5 "2019-10-21T10:49:55Z")

</div>

> [@matw](#):
>
> ,index:'logstash-\*'

When you're manually using Discover, and you select 'logstash-_' as index pattern, take a look at the url of you browser, check what's set in following part ,index:'logstash-_'. Normally when you add a index pattern manually, a UUID is generated as id, and that's the ID you should use. Hope this helps

---

<div class="post-metadata">

**Author:** ![rockyadi](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@rockyadi](https://discuss.elastic.co/u/rockyadi)\
**Post date:** [October 28, 2019, 7:58pm UTC](https://discuss.elastic.co/t/how-to-create-a-dynamic-url-for-kibana-discover/204152/6 "2019-10-28T19:58:04Z")

</div>

@matw tried it but looks the id is changing dynamically for example i had kibana#/discover?\_g=h@44136fa&\_a=h@d58c75e but a colleague had kibana#/discover?\_g=h@44136fa&\_a=h@8e6425b when adding the index, i feel we are close but jus need to get the index part sorted out and appreciate the community's help in overcoming this 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:** [November 25, 2019, 7:58pm UTC](https://discuss.elastic.co/t/how-to-create-a-dynamic-url-for-kibana-discover/204152/7 "2019-11-25T19:58:07Z")

</div>

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