examples/node/helloworld/search_normal.js
function(results, job, done) {
                // Print out the statics
                console.log("Job Statistics: ");
                console.log("  Event Count: " + job.properties().eventCount);
                console.log("  Disk Usage: " + job.properties().diskUsage + " bytes");
                console.log("  Priority: " + job.properties().priority);

                // Find the index of the fields we want
                var rawIndex = results.fields.indexOf("_raw");
                var sourcetypeIndex = results.fields.indexOf("sourcetype");
                var userIndex = results.fields.indexOf("user");
                
                // Print out each result and the key-value pairs we want
                console.log("Results: ");
                for(var i = 0; i < results.rows.length; i++) {
                    console.log("  Result " + i + ": ");
                    console.log("    sourcetype: " + results.rows[i][sourcetypeIndex]);
                    console.log("    user: " + results.rows[i][userIndex]);
                    console.log("    _raw: " + results.rows[i][rawIndex]);
                }
                
                // Once we're done, cancel the job.
                job.cancel(done);
            }
function(results, job, done) {
                // Print out the statics
                console.log("Job Statistics: ");
                console.log("  Event Count: " + job.properties().eventCount);
                console.log("  Disk Usage: " + job.properties().diskUsage + " bytes");
                console.log("  Priority: " + job.properties().priority);

                // Find the index of the fields we want
                var rawIndex = results.fields.indexOf("_raw");
                var sourcetypeIndex = results.fields.indexOf("sourcetype");
                var userIndex = results.fields.indexOf("user");
                
                // Print out each result and the key-value pairs we want
                console.log("Results: ");
                for(var i = 0; i < results.rows.length; i++) {
                    console.log("  Result " + i + ": ");
                    console.log("    sourcetype: " + results.rows[i][sourcetypeIndex]);
                    console.log("    user: " + results.rows[i][userIndex]);
                    console.log("    _raw: " + results.rows[i][rawIndex]);
                }
                
                // Once we're done, cancel the job.
                job.cancel(done);
            }
function ( results , job , done ) { // Print out the statics console . log ( "Job Statistics: " ) ; console . log ( "  Event Count: " + job . properties ( ) . eventCount ) ; console . log ( "  Disk Usage: " + job . properties ( ) . diskUsage + " bytes" ) ; console . log ( "  Priority: " + job . properties ( ) . priority ) ; // Find the index of the fields we want var rawIndex = results . fields . indexOf ( "_raw" ) ; var sourcetypeIndex = results . fields . indexOf ( "sourcetype" ) ; var userIndex = results . fields . indexOf ( "user" ) ; // Print out each result and the key-value pairs we want console . log ( "Results: " ) ; for ( var i = 0 ; i < results . rows . length ; i ++ ) { console . log ( "  Result " + i + ": " ) ; console . log ( "    sourcetype: " + results . rows [ i ] [ sourcetypeIndex ] ) ; console . log ( "    user: " + results . rows [ i ] [ userIndex ] ) ; console . log ( "    _raw: " + results . rows [ i ] [ rawIndex ] ) ; } // Once we're done, cancel the job. job . cancel ( done ) ; }
Print out the statistics and get the results
Print out the statistics and get the results