Hello all!
Newbie here. I am trying to build an external tool that constructs requests to Elasticsearch that will return the same data displayed in the discover tab of Kibana when a saved search is opened, and then export said data to various places.
I have set up a UI that will retrieve all of the saved searches that are in projects I have access to, but I am currently stuck trying to figure out how to use the saved search objects to construct a request that will return only the columns provided by the saved search and their timestamps.
Consider the following JSON document returned from a call in my programs API:
{
"success": true,
"data": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": ".kibana_demo-index",
"_type": "search",
"_id": "Demo-Search",
"_score": 1,
"_source": {
"title": "Demo Search",
"description": "",
"hits": 0,
"columns": [
"type",
"AppId",
"LauncherAppId",
"Uuid"
],
"sort": [
"#demo-timestamp",
"desc"
],
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"index\":\"[demo-index-]YYYY.MM\",\"highlight\":{\"pre_tags\":[\"@kibana-highlighted-field@\"],\"post_tags\":[\"@/kibana-highlighted-field@\"],\"fields\":{\"*\":{}},\"fragment_size\":2147483647},\"filter\":[],\"query\":{\"query_string\":{\"query\":\"*\",\"lowercase_expanded_terms\":false,\"analyze_wildcard\":true}}}"
}
}
}
]
}
}
The above JSON document contains the information of a saved search in a project I have access to. The search populates the discover table with 4 columns of data listed above and sorts the timestamp for the events.
- How can I use the information from the search above to query and return a JSON document only containing the same information displayed in the discover table?
I hope that makes sense, please let me know if you need any clarification. Thank you in advance for your time!
Joey