# Can I make scripts I run in Kibana tools into Kibana objects

**URL:** <https://discuss.elastic.co/t/can-i-make-scripts-i-run-in-kibana-tools-into-kibana-objects/326471>\
**Category:** Kibana\
**Tags:** painless\
**Created:** [February 24, 2023, 8:11pm UTC](https://discuss.elastic.co/t/can-i-make-scripts-i-run-in-kibana-tools-into-kibana-objects/326471 "2023-02-24T20:11:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gyannea](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@gyannea](https://discuss.elastic.co/u/gyannea)\
**Post date:** [February 24, 2023, 8:11pm UTC](https://discuss.elastic.co/t/can-i-make-scripts-i-run-in-kibana-tools-into-kibana-objects/326471/1 "2023-02-24T20:11:15Z")

</div>

I can write REST, painless, etc. scripts using the Kibana tools (dev Tools) console. At least I can write REST searches. Is it possible to take these searches and make them into a Kibana object? Right now it only seems possible to take the very limited filter operations provided in the discover interface and make them objects.

When I edit the filter in the discovery interface and copy in my script from the dev Tools console, Kibana changes it and removes fields. How can I keep what I create in dev Tools console that does what I want it to do?

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [February 28, 2023, 4:53pm UTC](https://discuss.elastic.co/t/can-i-make-scripts-i-run-in-kibana-tools-into-kibana-objects/326471/2 "2023-02-28T16:53:17Z")

</div>

The "add a filter" dialog only supports filters/queries, not other parts of an Elasticsearch \_search request (such as aggs, size, etc.).

The only way to turn a generic query into an "object" is to use a "custom visualization" (e.g. Vega):

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/0/a0febae89e3209e93f4100ff5e4389290dbb8889.png)

---

<div class="post-metadata">

**Author:** ![gyannea](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@gyannea](https://discuss.elastic.co/u/gyannea)\
**Post date:** [March 1, 2023, 9:04am UTC](https://discuss.elastic.co/t/can-i-make-scripts-i-run-in-kibana-tools-into-kibana-objects/326471/3 "2023-03-01T09:04:21Z")

</div>

Okay, now I know! Wondered if I was missing something when viewing the request code (could not find a 'save' option).

---

<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:** [March 29, 2023, 9:05am UTC](https://discuss.elastic.co/t/can-i-make-scripts-i-run-in-kibana-tools-into-kibana-objects/326471/4 "2023-03-29T09:05:10Z")

</div>

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