# Retrieving results by using kibanaSavedObjectMeta.searchSourceJSON from a saved search

**URL:** https://discuss.elastic.co/t/retrieving-results-by-using-kibanasavedobjectmeta-searchsourcejson-from-a-saved-search/189464
**Category:** Kibana
**Created:** [July 9, 2019, 6:49am UTC](https://discuss.elastic.co/t/retrieving-results-by-using-kibanasavedobjectmeta-searchsourcejson-from-a-saved-search/189464 "2019-07-09T06:49:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Lars\_Veelaert](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lars_veelaert/32/49671_2.png) [@Lars\_Veelaert](https://discuss.elastic.co/u/Lars_Veelaert)
#### Post date: [July 9, 2019, 6:49am UTC](https://discuss.elastic.co/t/retrieving-results-by-using-kibanasavedobjectmeta-searchsourcejson-from-a-saved-search/189464/1 "2019-07-09T06:49:16Z")

</div>

I have a use-case that demands reading out the API for saved searches in Kibana and retrieving the results.

There seems to be no API for Kibana to do this.  
A defined saved search can be retrieved and in it's json response you can find the field 'kibanaSavedObjectMeta.searchSourceJSON' which has the following structure:

> {  
> "index": "a40f4f20-972d-11e9-a4aa-9b663566a96d",  
> "highlightAll": true,  
> "version": true,  
> "query": {  
> "language": "kuery",  
> "query": ""  
> },  
> "filter": [  
> {  
> "$state": {  
> "store": "appState"  
> },  
> "meta": {  
> "alias": null,  
> "disabled": false,  
> "index": "a40f4f20-972d-11e9-a4aa-9b663566a96d",  
> "key": "\_type",  
> "negate": false,  
> "params": {  
> "query": "datacenter-patching",  
> "type": "phrase"  
> },  
> "type": "phrase",  
> "value": "datacenter-patching"  
> },  
> "query": {  
> "match": {  
> "\_type": {  
> "query": "datacenter-patching",  
> "type": "phrase"  
> }  
> }  
> }  
> },  
> {  
> "meta": {  
> "negate": false,  
> "index": "a40f4f20-972d-11e9-a4aa-9b663566a96d",  
> "type": "phrase",  
> "key": "doc.Patching Status",  
> "value": "Non-compliant",  
> "params": {  
> "query": "Non-compliant",  
> "type": "phrase"  
> },  
> "disabled": false,  
> "alias": null  
> },  
> "query": {  
> "match": {  
> "doc.Patching Status": {  
> "query": "Non-compliant",  
> "type": "phrase"  
> }  
> }  
> },  
> "$state": {  
> "store": "appState"  
> }  
> }  
> ]  
> }

Now, after a lot of Google searches I can't seem to find a way to transform this in a Elasticsearch query or something useful to retrieve the actual results.  
Strange because if you go to the saved search in the UI \> Inspect \> Request, you can see the actual Elasticsearch query I need.

Anybody any idea?

---

<div class="post-metadata">

### Author: ![Aaron\_Caldwell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron_caldwell/32/45755_2.png) [@Aaron\_Caldwell](https://discuss.elastic.co/u/Aaron_Caldwell)
#### Post date: [July 9, 2019, 2:40pm UTC](https://discuss.elastic.co/t/retrieving-results-by-using-kibanasavedobjectmeta-searchsourcejson-from-a-saved-search/189464/2 "2019-07-09T14:40:12Z")

</div>

Hello Lars,

Your best bet would probably be to interact with your saved searches via the [Saved Object API](http://www.elastic.co/guide/en/kibana/master/saved-objects-api-find.html), since Saved Searches are just a type of Saved Object in Kibana. We do expose the Elasticsearch queries occurring to the user via Inspect as you noticed, but I don't believe they're available via query.

You could use a Python (or other) script to retrieve the Saved Objects, filter for Saved Searches and then re-execute the searches using the same parameters.

Regards,  
Aaron

---

<div class="post-metadata">

### Author: ![Lars\_Veelaert](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lars_veelaert/32/49671_2.png) [@Lars\_Veelaert](https://discuss.elastic.co/u/Lars_Veelaert)
#### Post date: [July 10, 2019, 8:51am UTC](https://discuss.elastic.co/t/retrieving-results-by-using-kibanasavedobjectmeta-searchsourcejson-from-a-saved-search/189464/3 "2019-07-10T08:51:07Z")

</div>

Hi Aaron,

Thanks for your answer,  
What I do now is re-parse the saved search parameters into an Elastic Search query, which feels dirty.

Is there a way to execute the query directly? (without reparsing the parameters, querystring, filters, aggregations, ...)

---

<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: [August 7, 2019, 8:51am UTC](https://discuss.elastic.co/t/retrieving-results-by-using-kibanasavedobjectmeta-searchsourcejson-from-a-saved-search/189464/4 "2019-08-07T08:51:09Z")

</div>

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