<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Splunk Java SDK:  Why does &amp;quot;Export Search&amp;quot; return significantly fewer results than an identical search in Splunk Web? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Java-SDK-Why-does-quot-Export-Search-quot-return/m-p/217219#M63795</link>
    <description>&lt;P&gt;May have found at least a partial answer/solution... my query string ended with:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... | table entityKey&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;What seems to have made a difference is using "fields" instead:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... | fields entityKey | fields - _*&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;And then of course it turns out this line (which I added after my flailing had begun) prevents the search from ever finishing:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;searchArgs.setAutoFinalizeEventCount(0);&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;So, fix the search string, remove that Arg, and voila:  ~4M unique results.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Feb 2016 03:46:12 GMT</pubDate>
    <dc:creator>bentuit</dc:creator>
    <dc:date>2016-02-24T03:46:12Z</dc:date>
    <item>
      <title>Splunk Java SDK:  Why does "Export Search" return significantly fewer results than an identical search in Splunk Web?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Java-SDK-Why-does-quot-Export-Search-quot-return/m-p/217218#M63794</link>
      <description>&lt;P&gt;&lt;STRONG&gt;I've been experimenting with a number of different settings, but here are my current search args:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;JobExportArgs searchArgs = new JobExportArgs();
searchArgs.setIndexEarliest(startDate.toString("YYYY-MM-DDThh:mm:ss.mss"));
searchArgs.setIndexLatest(endDate.toString("YYYY-MM-DDThh:mm:ss.mss"));
searchArgs.setSearchMode(JobExportArgs.SearchMode.NORMAL);
searchArgs.setOutputMode(JobExportArgs.OutputMode.XML);
searchArgs.setAutoCancel(0);
searchArgs.setAutoFinalizeEventCount(0);
searchArgs.setAutoPause(0);
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;I then invoke the search and parse the result more or less identically to the code sample in "To run an export search"...&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;MultiResultsReaderXml multiResultsReader = new MultiResultsReaderXml(service.export(search, searchArgs));
for (SearchResults searchResults : multiResultsReader) {
    if (searchResults.isPreview())
        log.info("Search in progress");
    else 
        log.info("Search finalized");

    for (Event event : searchResults) {
        for (String k: event.keySet()) {
            String s = event.get(k);
            // add string to collection
        }
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;This returns on the order of 100k-200k results, many of which are duplicates.  If I paste the exact same search string into the Web UI, and set the custom time range to the exact same earliest/latest times, I get back ~4M unique results.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;This is a very large search, which is why I opted for the export search (based on documentation); was that the wrong move?  Am I doing something wrong in the parsing of my results?  Am I missing some vital search arg?  You can see I'm setting everything to 0 right now, mostly because I have no idea what might be cutting the search off short.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 01:46:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Java-SDK-Why-does-quot-Export-Search-quot-return/m-p/217218#M63794</guid>
      <dc:creator>bentuit</dc:creator>
      <dc:date>2016-02-24T01:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Java SDK:  Why does "Export Search" return significantly fewer results than an identical search in Splunk Web?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Java-SDK-Why-does-quot-Export-Search-quot-return/m-p/217219#M63795</link>
      <description>&lt;P&gt;May have found at least a partial answer/solution... my query string ended with:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... | table entityKey&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;What seems to have made a difference is using "fields" instead:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... | fields entityKey | fields - _*&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;And then of course it turns out this line (which I added after my flailing had begun) prevents the search from ever finishing:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;searchArgs.setAutoFinalizeEventCount(0);&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;So, fix the search string, remove that Arg, and voila:  ~4M unique results.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 03:46:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Java-SDK-Why-does-quot-Export-Search-quot-return/m-p/217219#M63795</guid>
      <dc:creator>bentuit</dc:creator>
      <dc:date>2016-02-24T03:46:12Z</dc:date>
    </item>
  </channel>
</rss>

