Constructor
new ResultsContext(marClient, searchId, resultCount, errorCount, hostCount, subscribedHostCount)
Parameters:
Name | Type | Description |
---|---|---|
marClient |
MarClient | The MAR client used to perform the search. |
searchId |
String | The identifier assigned to the search. |
resultCount |
Number | The total count of items available in the search results. |
errorCount |
Number | The count of errors that were reported during the search. |
hostCount |
Number | The count of endpoints that responded to the search. |
subscribedHostCount |
Number | The count of endpoints that were connected to the DXL fabric when the search started. |
- Source:
- See:
Members
errorCount :Number
The count of errors that were reported during the search.
Type:
- Number
- Source:
hostCount :Number
The count of endpoints that responded to the search.
Type:
- Number
- Source:
resultCount :Number
The total count of items available in the search results.
Type:
- Number
- Source:
searchId :String
The identifier assigned to the search.
Type:
- String
- Source:
subscribedHostCount :Number
The count of endpoints that were connected to the DXL fabric when the search started.
Type:
- Number
- Source:
Methods
getResults(callback, options)
This method is used to retrieve a particular set of results from a MAR search.
Results
Each search result item has the following fields:
id
: The identifier of the item within the search resultscount
: The number of times that the search result was reportedcreated_at
: The item timestampoutput
: The search result data where each key is composed of<CollectorName>|<OutputName>
and the value that corresponds to thatcollector
andoutput name
.
The object below is an example of a result that would be returned from the following textual search:
Processes name, id where Processes name equals "csrss" and Processes name
contains "exe" or Processes size not greater than 200
{
'startIndex': 0,
'totalItems': 2,
'currentItemCount': 2,
'itemsPerPage': 20,
'items': [
{
'id': '{1=[[System Process], 0]}',
'count': 2,
'created_at': '2016-11-16T22:50:04.650Z',
'output': {
'Processes|id': 0,
'Processes|name': '[System Process]'
}
},
{
'id": '{1=[System, 4]}',
'count': 1,
'created_at': '2016-11-16T22:50:04.650Z',
'output': {
'Processes|id': 4,
'Processes|name': 'System'
}
}
]
}
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
function | Callback function to invoke with a set of
results from the search. If an error occurs when performing the lookup, the
first parameter supplied to the callback contains an |
||||||||||||||||||||||||||||||
options |
Object | Options to use in getting search results. Properties
|
- Source:
Example
resultContext.getResults(
function (resultError, searchResult) {
if (resultError) {
// Handle error
} else {
searchResult.items.forEach(function (item) {
console.log(' ' + item.output['Processes|name'])
})
}
},
{
sortBy: 'Processes|name',
sortDirection: 'asc'
}
)