<?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 subquery not returning results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/subquery-not-returning-results/m-p/494285#M137796</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have two queries one from 1st_index and another from 2nd_index both are separately are giving correct outputs but when i combine them i get 0 results. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="1st_index" 
| eval name=upper(name) 
| search name=ABCD  
|search  index="2nd_index" 
| fillnull value="Other" 
| mvexpand infrastructure{}.name 
| rename infra{}.name as "Infrastrucure Name" name as Nom infra{}.type as type 
| table "Infrastrucure Name" Nom type 
| mvexpand type 
| eval Nom=upper(Nom)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want the name from 1st output to be the searched in the second subquery. &lt;BR /&gt;
And at the end show few columns from 1st query and few from 2nd query. &lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 05:22:14 GMT</pubDate>
    <dc:creator>surekhasplunk</dc:creator>
    <dc:date>2020-09-30T05:22:14Z</dc:date>
    <item>
      <title>subquery not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subquery-not-returning-results/m-p/494285#M137796</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have two queries one from 1st_index and another from 2nd_index both are separately are giving correct outputs but when i combine them i get 0 results. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="1st_index" 
| eval name=upper(name) 
| search name=ABCD  
|search  index="2nd_index" 
| fillnull value="Other" 
| mvexpand infrastructure{}.name 
| rename infra{}.name as "Infrastrucure Name" name as Nom infra{}.type as type 
| table "Infrastrucure Name" Nom type 
| mvexpand type 
| eval Nom=upper(Nom)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want the name from 1st output to be the searched in the second subquery. &lt;BR /&gt;
And at the end show few columns from 1st query and few from 2nd query. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:22:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subquery-not-returning-results/m-p/494285#M137796</guid>
      <dc:creator>surekhasplunk</dc:creator>
      <dc:date>2020-09-30T05:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: subquery not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subquery-not-returning-results/m-p/494286#M137797</link>
      <description>&lt;P&gt;You don't have a subsearch in your query.  The &lt;CODE&gt;search&lt;/CODE&gt; command is processing the results from 1st_index.  Since only events with &lt;CODE&gt;index=1st_index&lt;/CODE&gt; have been fetched, a search for &lt;CODE&gt;index=2nd_index&lt;/CODE&gt; will return nothing.&lt;/P&gt;

&lt;P&gt;A subsearch must be enclosed in square brackets.  Something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="1st_index" 
| eval name=upper(name) 
| search name=ABCD  
|[ search  index="2nd_index" 
  | fillnull value="Other" 
  | mvexpand infrastructure{}.name 
  | rename infra{}.name as "Infrastrucure Name" name as Nom infra{}.type as type ]
| table "Infrastrucure Name" Nom type 
| mvexpand type 
| eval Nom=upper(Nom)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Before combining two searches, run what will be the subsearch by itself with &lt;CODE&gt;| format&lt;/CODE&gt; appended.  See if the results make sense when appended to what comes before the subsearch.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:22:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subquery-not-returning-results/m-p/494286#M137797</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-09-30T05:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: subquery not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subquery-not-returning-results/m-p/494287#M137798</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/193316"&gt;@surekhasplunk&lt;/a&gt;,&lt;/P&gt;

&lt;P&gt;please try infra_name instead of infra{}.name. By default splunk "cleans" all field names, all dots and brakets are replaced with "_".&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:22:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subquery-not-returning-results/m-p/494287#M137798</guid>
      <dc:creator>PavelP</dc:creator>
      <dc:date>2020-09-30T05:22:22Z</dc:date>
    </item>
  </channel>
</rss>

