<?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: Creating a join when first search contains multiple values for a single field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448828#M127146</link>
    <description>&lt;P&gt;Here's a simplified version of my search.  Note, that this doesn't return results the way I would like either.  It only returns values where the number of id values are equal, and the id values match&lt;BR /&gt;
index=myindex "instances{}.id"="&lt;EM&gt;" | rename "instances{}.id as id &lt;BR /&gt;
    |  join inner id [search index=myindex2 earliest=-1d id=&lt;/EM&gt;]&lt;/P&gt;

&lt;P&gt;The reason for the join is that index2 contains a "name" field that I want to include in my report.  both contain ID fields, although I have to rename the one from index1 since it has a different name&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jul 2018 16:33:25 GMT</pubDate>
    <dc:creator>richnavis</dc:creator>
    <dc:date>2018-07-20T16:33:25Z</dc:date>
    <item>
      <title>Creating a join when first search contains multiple values for a single field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448825#M127143</link>
      <description>&lt;P&gt;Hey all,  this one has be stumped.   I'm trying to join two searches where the first search includes a single field with multiple values.  The matching field in the second search ONLY ever contains a single value.   The search ONLY returns matches on the join when there are identical values for search 1 and search 2.  In other words if search 1 has a field named id, and contains id=a and id=b and the second search contains id=b, no results will be returned.  The search will ONLY return results if search 1 contains a single value for id.&lt;BR /&gt;
Does anyone have any suggestion on how to join a search with multiple values?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 01:25:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448825#M127143</guid>
      <dc:creator>richnavis</dc:creator>
      <dc:date>2018-07-20T01:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a join when first search contains multiple values for a single field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448826#M127144</link>
      <description>&lt;P&gt;@richnavis - If you have multiple values in outer query and single value in inner query also the join condition will work . please take a look into below sample code. kindly replace with a test index in inner query and test it ..  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval mytrimexaxis =mvappend("1531981800","1531982400","1531982700","1531983000","1531983600") 
| mvexpand mytrimexaxis 
| table mytrimexaxis
| join type=inner mytrimexaxis  [ index=*** (replace with ur tetsing index)
| eval mytrimexaxis="1531981800"
| table mytrimexaxis
] 
 | table mytrimexaxis
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Jul 2018 06:49:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448826#M127144</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2018-07-20T06:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a join when first search contains multiple values for a single field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448827#M127145</link>
      <description>&lt;P&gt;PLease share your query, that way is easier to understand why is not working, &lt;/P&gt;

&lt;P&gt;the logic of the join command  should be that  for each value on search 1 for the specific field you should have   results in search 2 with additional information (other fields)  .&lt;/P&gt;

&lt;P&gt;What do you want to get from search 2 to include on search 1 ? &lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 06:57:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448827#M127145</guid>
      <dc:creator>j_cabanillas</dc:creator>
      <dc:date>2018-07-20T06:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a join when first search contains multiple values for a single field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448828#M127146</link>
      <description>&lt;P&gt;Here's a simplified version of my search.  Note, that this doesn't return results the way I would like either.  It only returns values where the number of id values are equal, and the id values match&lt;BR /&gt;
index=myindex "instances{}.id"="&lt;EM&gt;" | rename "instances{}.id as id &lt;BR /&gt;
    |  join inner id [search index=myindex2 earliest=-1d id=&lt;/EM&gt;]&lt;/P&gt;

&lt;P&gt;The reason for the join is that index2 contains a "name" field that I want to include in my report.  both contain ID fields, although I have to rename the one from index1 since it has a different name&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 16:33:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448828#M127146</guid>
      <dc:creator>richnavis</dc:creator>
      <dc:date>2018-07-20T16:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a join when first search contains multiple values for a single field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448829#M127147</link>
      <description>&lt;P&gt;Note, there's an asterisk at the end of the equal size in both searches... the html isn't showing it. &lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 16:34:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448829#M127147</guid>
      <dc:creator>richnavis</dc:creator>
      <dc:date>2018-07-20T16:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a join when first search contains multiple values for a single field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448830#M127148</link>
      <description>&lt;P&gt;I think I know why it's not giving you what you need.&lt;BR /&gt;
In Search 2 you should include a table or stats of your results .&lt;/P&gt;

&lt;P&gt;something like  &lt;CODE&gt;[search index=myindex2 earliest=-1d id=*|stats values(name) as name  by id]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This will give you results that search 1 can use &lt;/P&gt;

&lt;P&gt;you query should be something like this &lt;CODE&gt;index=myindex "instances{}.id"="" | rename "instances{}.id as id&amp;nbsp; | join inner id [search index=myindex2 earliest=-1d id=*|stats values(name) as name  by id] | table id name&lt;/CODE&gt;  and other fields you want to include &lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 17:05:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448830#M127148</guid>
      <dc:creator>j_cabanillas</dc:creator>
      <dc:date>2018-07-20T17:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a join when first search contains multiple values for a single field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448831#M127149</link>
      <description>&lt;P&gt;Brilliant!   The key to making it work was to add the mvexpand into my first search.  I did not realize that this command existed, but once I added that into my first search, the first and second search joined just like I wanted them to. Thanks so much for the help&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 21:46:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448831#M127149</guid>
      <dc:creator>richnavis</dc:creator>
      <dc:date>2018-07-20T21:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a join when first search contains multiple values for a single field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448832#M127150</link>
      <description>&lt;P&gt;shankarananth, if you could convert your comment to an answer, I will accept that as the answer&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 21:50:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-join-when-first-search-contains-multiple-values-for-a/m-p/448832#M127150</guid>
      <dc:creator>richnavis</dc:creator>
      <dc:date>2018-07-20T21:50:12Z</dc:date>
    </item>
  </channel>
</rss>

