<?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 Getting empty results when running search with particular fields using Java SDK in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603238#M209933</link>
    <description>&lt;P&gt;Does anybody know why while I am able to get results when running query with any field in Splunk, I am&amp;nbsp; getting empty result when trying to run the same query for particular fields with Java SDK? Does that mean some fields are special somehow?&lt;/P&gt;&lt;P&gt;Sample query: search field1=value1&lt;/P&gt;&lt;P&gt;Java code:&lt;/P&gt;&lt;LI-CODE lang="java"&gt;JobArgs jobArgs=new JobArgs();
jobArgs.setEarliest("-1m@m");

String query="search field1=value1";
Job job=splunkService.getJobs().create(query, jobArgs);
while(!job.isDone()) {
    Thread.sleep(500);
}

JobResultsArgs resultsArgs=new JobResultsArgs();
resultsArgs.setOutPutMode(JSON);
job.getResults(resultsArgs);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 25 Jun 2022 07:28:00 GMT</pubDate>
    <dc:creator>john_dem8</dc:creator>
    <dc:date>2022-06-25T07:28:00Z</dc:date>
    <item>
      <title>Getting empty results when running search with particular fields using Java SDK</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603238#M209933</link>
      <description>&lt;P&gt;Does anybody know why while I am able to get results when running query with any field in Splunk, I am&amp;nbsp; getting empty result when trying to run the same query for particular fields with Java SDK? Does that mean some fields are special somehow?&lt;/P&gt;&lt;P&gt;Sample query: search field1=value1&lt;/P&gt;&lt;P&gt;Java code:&lt;/P&gt;&lt;LI-CODE lang="java"&gt;JobArgs jobArgs=new JobArgs();
jobArgs.setEarliest("-1m@m");

String query="search field1=value1";
Job job=splunkService.getJobs().create(query, jobArgs);
while(!job.isDone()) {
    Thread.sleep(500);
}

JobResultsArgs resultsArgs=new JobResultsArgs();
resultsArgs.setOutPutMode(JSON);
job.getResults(resultsArgs);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2022 07:28:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603238#M209933</guid>
      <dc:creator>john_dem8</dc:creator>
      <dc:date>2022-06-25T07:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Getting empty results when running search with particular fields using Java SDK</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603244#M209936</link>
      <description>&lt;P&gt;Do you use the same user for searching via webui as with rest?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2022 08:47:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603244#M209936</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-06-25T08:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Getting empty results when running search with particular fields using Java SDK</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603249#M209938</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;Yeah, I use the same username.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2022 09:16:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603249#M209938</guid>
      <dc:creator>john_dem8</dc:creator>
      <dc:date>2022-06-25T09:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Getting empty results when running search with particular fields using Java SDK</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603251#M209939</link>
      <description>&lt;P&gt;That is strange then. Different users could mean permission issues and problem with accessing field extractions definitions.&lt;/P&gt;&lt;P&gt;What I can suggest for troubleshooting, capture the guid, uid or whatever it's called of the rest-initiated job and compare the job details and job log with a web ui launched one.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2022 09:24:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603251#M209939</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-06-25T09:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Getting empty results when running search with particular fields using Java SDK</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603275#M209950</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;I just tried to run same query with SDK and in Splunk and I didn't get results with SDK. Here is the response:&lt;/P&gt;&lt;LI-CODE lang="java"&gt;{"preview":false, "post_process_count":0, "mesages":[], "results":[], "init_offset":0}&lt;/LI-CODE&gt;&lt;P&gt;I also noticed, the field I used in my query is not a default field in Splunk, it's under "Interesting fields" category.&lt;/P&gt;&lt;P&gt;I just created a job with SDK, copied the SID value and pasted it in Splunk URL:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; https://base_url.com/?sid=... &lt;/LI-CODE&gt;&lt;P&gt;but that was redirected to another SID and it displayed results in Splunk.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;Is that what you meant to do for troubleshooting?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2022 21:48:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603275#M209950</guid>
      <dc:creator>john_dem8</dc:creator>
      <dc:date>2022-06-25T21:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Getting empty results when running search with particular fields using Java SDK</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603288#M209956</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/247197"&gt;@john_dem8&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some other things that might be useful for troubleshooting:&lt;/P&gt;&lt;P&gt;You could search the _audit index to view the result_count for the search, if you have the search ID you could do:&lt;/P&gt;&lt;PRE&gt;index=_audit action=search info=completed search_id=&amp;lt;search ID goes here&amp;gt;&lt;/PRE&gt;&lt;P&gt;You could also use this to confirm the search is being executed as the same user as the UI search.&lt;/P&gt;&lt;P&gt;If you want to see the results of a search you can run:&lt;/P&gt;&lt;PRE&gt;| loadjob &amp;lt;search Id&amp;gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;You can also use the job inspector for a search by going to the following URL:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;A href="https://base_url.com/en-US/manager/search/job_inspector?sid=&amp;lt;search" target="_blank"&gt;https://base_url.com/en-US/manager/search/job_inspector?sid=&amp;lt;search&lt;/A&gt;&amp;nbsp;ID&amp;gt;&lt;BR /&gt;&lt;BR /&gt;There may be an error that shows up here.&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jamie&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jun 2022 09:01:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603288#M209956</guid>
      <dc:creator>jamie00171</dc:creator>
      <dc:date>2022-06-26T09:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Getting empty results when running search with particular fields using Java SDK</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603294#M209958</link>
      <description>&lt;P&gt;That's what I was talking about &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/247197"&gt;@john_dem8&lt;/a&gt;if you take the search ID you get from your REST call and after loading the job in UI you get results, it most probably means you're not waiting long enough for the results.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jun 2022 15:13:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603294#M209958</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-06-26T15:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: Getting empty results when running search with particular fields using Java SDK</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603300#M209962</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/211432"&gt;@jamie00171&lt;/a&gt;&amp;nbsp;I tried to search _audit index but didn't get any results for SID I used with SDK or for one I used directly in Splunk.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I ran this:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| loadjob &amp;lt;search Id&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;and was not able to see any data for SID using SDK.&lt;/P&gt;&lt;P&gt;I also tried this:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; https://base_url.com/en-US/manager/search/job_inspector?sid=&amp;lt;search ID&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;and it said: &lt;EM&gt;"This search has completed in 0.98 seconds but did not match any events. The terms specified in the highlighted portion of the search: &amp;lt;my query here&amp;gt;...."&lt;/EM&gt; I ran that query in Splunk and it returned some events.&lt;/P&gt;&lt;P&gt;So I am still not sure what can be wrong with SDK.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jun 2022 18:55:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603300#M209962</guid>
      <dc:creator>john_dem8</dc:creator>
      <dc:date>2022-06-26T18:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Getting empty results when running search with particular fields using Java SDK</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603305#M209965</link>
      <description>&lt;P&gt;Are you searching over the same period from the webui?&lt;/P&gt;&lt;P&gt;Your rest call seems to be only searching over last minute or so.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jun 2022 21:25:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-empty-results-when-running-search-with-particular-fields/m-p/603305#M209965</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-06-26T21:25:46Z</dc:date>
    </item>
  </channel>
</rss>

