SavedSearchManager

Description

The SavedSearch manager is a manager that encapsulates the dispatch of a saved report.

Documentation

Library path

Properties

Name

Default value

Description

id Required. The unique ID for this control.
appThe current appSets the namespace (the app context) to run in. For example, let's say your app, MyApp, runs saved searches. By default, all searches are run in the context of your MyApp app. If you try to run a search that is private to the Search app, you'll get an error, so you need to change this "app" property to "search" to successfully run those searches.
autostarttrueWhen true, the manager will automatically start a new job whenever any search properties change or when the page is loaded (the component-loader is called). If false, application code must call startSearch manually to start a search.
cachefalsetrue: Always use the results from a preexisting search job when possible.
false: Never use results from preexisting search jobs.
scheduled: Reuse any previously-run scheduled jobs.
n: The number of seconds indicating the maximum age a search job can be to use its results. Results from search jobs that are newer than n seconds will be used.
cancelOnUnloadtrueWhen true, cancels any running searches when navigating away from the page.
dispatch.propertynametrueIndicated whether to enable dispatch properties. The following properties are available:

    buckets
    earliest_time
    enable_lookups
    indexedRealtime
    latest_time
    lookups
    max_count
    max_time
    reduce_freq
    rt_backfill
    spawn_process
    status_buckets
    time_format
    ttl
ownerThe current ownerSets the namespace (the owner context) to run in.
searchname Required. The name of the saved report.

Methods

Name

Description

cancelCancels the search job.
dataReturns the results model
events | preview | results | summary ).
finalizeFinalizes the search job.
pausePauses the search job.
startSearchCreates the search job.
unpauseResumes the search job.

Events

Name

Description

search:cancelledFired when the search is cancelled. Changing the properties of the search starts a new one, which may cancel an old search.
search:doneFired when the search has finished. Note that this event is never fired for a real-time search.
search:errorFired when an error occurs, such as when the user does not provide a search query, the user does not provide a valid name of a saved search, or when a network failure occurs.
search:failedFired when the search job fails.
search:progressFired to indicate search progress.
search:startFired when the search is successfully started.

Example (Django tag)

{% savedsearchmanager 
    id="example-saved-report" 
    searchname="Report - Top Pageview" 
    cache=True 
    preview=True 
    app="search" %}

Example (JavaScript)

<script>
    var deps = [
        "splunkjs/ready!",
        "splunkjs/mvc/savedsearchmanager"
    ];
    require(deps, function(mvc) {
        var SavedSearchManager = require("splunkjs/mvc/savedsearchmanager");

        // Create manager
        new SavedSearchManager({
            id: "example-saved-report",
            searchname: "Report - Top Pageview",
            cache: true,
            preview: true,
            "dispatch.earliest_time": "-24h@h",
            "dispatch.latest_time": "now",
            app: "search"
        });

    });
</script>