Base manager class
Description
The base class used for search managers. This class is not designed to be subclassed.
Library path
Properties common to all search managers
Name | Default value | Description |
id | | Required. The unique ID for this control. |
settings | | The properties of the search manager. See the methods below to get and set values. |
Methods common to all search managers
Name | Description |
cancel | Cancels the search job. |
data(results_type) | Returns the results model as a SplunkResultsModel object.Valid values for results_type are: ( events | preview | results | summary ).
The SplunkResultsModel object has the following methods:
- data: Returns an array of rows containing data.
- collection: Returns a Backbone collection containing an array of rows of data.
- hasData: Returns a Boolean that indicates whether the object contains data.
For details about working with the results model, see Search results model. |
finalize | Finalizes the search job. |
pause | Pauses the search job. |
settings.get( property ) | Returns the value of property for the current component. |
settings.set( property, value ) | Sets the value of property to the specified value for the current component. |
startSearch | Creates the search job. |
unpause | Resumes the search job. |
Events common to all search managers
Name | Description |
search:cancelled | Fired when the search is cancelled. Changing the
properties of the search starts a new one, which may cancel an old search. |
search:done | Fired when the search has finished. Note that this event is never fired for a real-time search. |
search:error | Fired 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:failed | Fired when the search job fails. |
search:progress | Fired to indicate search progress. |
search:start | Fired when the search is successfully started. |
Example constructor
require([
"splunkjs/mvc/searchmanager",
"splunkjs/mvc/simplexml/ready!"
], function(SearchManager) {
var mysearch = new SearchManager({
id: "search1",
preview: true,
cache: true,
status_buckets: 300,
search: "index=_internal | head 1000 | stats count by sourcetype"
});
});