# Create Kibana plugin to write x-large queries

**URL:** <https://discuss.elastic.co/t/create-kibana-plugin-to-write-x-large-queries/257616>\
**Category:** Kibana\
**Created:** [December 4, 2020, 7:39am UTC](https://discuss.elastic.co/t/create-kibana-plugin-to-write-x-large-queries/257616 "2020-12-04T07:39:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![malsioufi](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@malsioufi](https://discuss.elastic.co/u/malsioufi)\
**Post date:** [December 4, 2020, 7:39am UTC](https://discuss.elastic.co/t/create-kibana-plugin-to-write-x-large-queries/257616/1 "2020-12-04T07:39:09Z")

</div>

I have an Elasticsearch index of millions of documents. Elasticsearch provides the ability to build statistics and aggregations out of this data and Kibana provides a nice out-of-the-box way to visualize this data.

However, my users want to be able to have statistics, aggregations and visualizations over a random subsets of the mentioned data. So, for example to be able to upload a text file that contains thousands of "\_id"s and Kibana takes care of querying for these \_id's instead of the user has to write them one by one in the search-bar.

I was thinking about building a Kibana plugin that renders an upload button in one of the dashboards (maybe as a visualization?) or in the Discover page. They user can use this button to upload a file with the \_id's, then the plugin translates this list into an Elasticsearch query.  
However, I know that Kibana uses the URL to carry the query which has a length constrain that prevents me from being able to convert the list of thousands \_id's into an Elasticsearch query.

Is there a way to implement this functionality other than what I mentioned? What are the possible ways to do this other than building a separate interface?

---

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [December 4, 2020, 8:17am UTC](https://discuss.elastic.co/t/create-kibana-plugin-to-write-x-large-queries/257616/2 "2020-12-04T08:17:51Z")

</div>

Hi,

Have you tried using `state:storeInSessionStorage`: [https://www.elastic.co/guide/en/kibana/7.10/advanced-options.html](https://www.elastic.co/guide/en/kibana/7.10/advanced-options.html)

This stores the state in the browsers session storage and keeps the URL shorter: [https://myhost:5601/app/discover#/?\_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)](https://myhost:5601/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)))&\_a=h@ed809a3

Be aware that this is still marked as experimental!

Best regards  
Wolfram

---

<div class="post-metadata">

**Author:** ![malsioufi](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@malsioufi](https://discuss.elastic.co/u/malsioufi)\
**Post date:** [December 4, 2020, 1:50pm UTC](https://discuss.elastic.co/t/create-kibana-plugin-to-write-x-large-queries/257616/3 "2020-12-04T13:50:15Z")

</div>

> [@Wolfram\_Haussig](#):
>
> state:storeInSessionStorage

This seems to be something to look at. I am not sure, but maybe I can use the session storage in my plug in as well! I will look into this. Thanks!

---

<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 1, 2021, 1:50pm UTC](https://discuss.elastic.co/t/create-kibana-plugin-to-write-x-large-queries/257616/4 "2021-01-01T13:50:19Z")

</div>

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