<?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: Mismatch with values in Join in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Mismatch-with-values-in-Join/m-p/392572#M168874</link>
    <description>&lt;P&gt;With &lt;CODE&gt;type=inner&lt;/CODE&gt; in join command, you'd see matching records from both the sources (main search and subsearch), hence the result is limited to only the STYPE=08 OR STYPE=29. The joins are very expensive, and you should look for alternative implementation for it. &lt;/P&gt;

&lt;P&gt;If you have to use join, use &lt;CODE&gt;type=left&lt;/CODE&gt; so that all rows from left (main search) will be returned, along with matched ones.&lt;/P&gt;

&lt;P&gt;Alternatively, you can use following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=edi-2 OR index=edi | eval TRACKINGNUMBER=coalesce(TRACKINGNUMBER, TRCK)
| stats count(TRACKINGNUMBER)  values(index) as indexes BY STYPE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should give count by STYPE for records in both indexes. &lt;BR /&gt;
To get records same as &lt;CODE&gt;| join type=inner&lt;/CODE&gt;, add &lt;CODE&gt;| where mvcount(indexes)=2 | fields - indexes&lt;/CODE&gt;.&lt;BR /&gt;
To get records same as &lt;CODE&gt;| join type=left&lt;/CODE&gt;, add &lt;CODE&gt;| where NOT mvcount(indexes)=1 AND indexes="edi" | fields - indexes&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jun 2018 20:27:51 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2018-06-14T20:27:51Z</dc:date>
    <item>
      <title>Mismatch with values in Join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mismatch-with-values-in-Join/m-p/392571#M168873</link>
      <description>&lt;P&gt;When I run this query:&lt;BR /&gt;
&lt;CODE&gt;index=edi-2 | join type=inner TRACKINGNUMBER [search index=edi | rename TRCK AS TRACKINGNUMBER] | stats count(TRACKINGNUMBER) BY STYPE&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I get these results:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;STYPE count(TRACKINGNUMBER) 01    2140&lt;BR /&gt;
&lt;STRONG&gt;08  38&lt;/STRONG&gt;&lt;BR /&gt;
 10   284&lt;BR /&gt;
 13   1122&lt;BR /&gt;
 22   539 &lt;BR /&gt;
 25   349&lt;BR /&gt;
&lt;STRONG&gt;29  4&lt;/STRONG&gt;&lt;BR /&gt;
32    236&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;However, if I add this &lt;CODE&gt;where&lt;/CODE&gt; clause:&lt;BR /&gt;
&lt;CODE&gt;index=edi-2 | join type=inner TRACKINGNUMBER [search index=edi | rename TRCK AS TRACKINGNUMBER | where STYPE=08 OR STYPE=29] | stats count(TRACKINGNUMBER) BY STYPE&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I get this:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;STYPE count(TRACKINGNUMBER)&lt;BR /&gt;
&lt;STRONG&gt;08  166&lt;BR /&gt;
 29   4572&lt;/STRONG&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;WTH?? How is that possible? Shouldn't &lt;CODE&gt;08&lt;/CODE&gt; and &lt;CODE&gt;29&lt;/CODE&gt; match up with the first set of results?? What am I missing with this?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 19:34:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mismatch-with-values-in-Join/m-p/392571#M168873</guid>
      <dc:creator>tlunruh</dc:creator>
      <dc:date>2018-06-14T19:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Mismatch with values in Join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mismatch-with-values-in-Join/m-p/392572#M168874</link>
      <description>&lt;P&gt;With &lt;CODE&gt;type=inner&lt;/CODE&gt; in join command, you'd see matching records from both the sources (main search and subsearch), hence the result is limited to only the STYPE=08 OR STYPE=29. The joins are very expensive, and you should look for alternative implementation for it. &lt;/P&gt;

&lt;P&gt;If you have to use join, use &lt;CODE&gt;type=left&lt;/CODE&gt; so that all rows from left (main search) will be returned, along with matched ones.&lt;/P&gt;

&lt;P&gt;Alternatively, you can use following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=edi-2 OR index=edi | eval TRACKINGNUMBER=coalesce(TRACKINGNUMBER, TRCK)
| stats count(TRACKINGNUMBER)  values(index) as indexes BY STYPE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should give count by STYPE for records in both indexes. &lt;BR /&gt;
To get records same as &lt;CODE&gt;| join type=inner&lt;/CODE&gt;, add &lt;CODE&gt;| where mvcount(indexes)=2 | fields - indexes&lt;/CODE&gt;.&lt;BR /&gt;
To get records same as &lt;CODE&gt;| join type=left&lt;/CODE&gt;, add &lt;CODE&gt;| where NOT mvcount(indexes)=1 AND indexes="edi" | fields - indexes&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 20:27:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mismatch-with-values-in-Join/m-p/392572#M168874</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-06-14T20:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Mismatch with values in Join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mismatch-with-values-in-Join/m-p/392573#M168875</link>
      <description>&lt;P&gt;Thanks @somesoni2. I ran your new search and it gave me different data, but I am still not sure it is right. I am sure I am trying to use Splunk JOINs like SQL (which I am very familiar with) and not understanding the overhead/results. What I am really trying to get (for the first pass), is the &lt;CODE&gt;STYPE&lt;/CODE&gt;  from &lt;CODE&gt;index=edi&lt;/CODE&gt; for each matching &lt;CODE&gt;TRACKINGNUMBER&lt;/CODE&gt; in &lt;CODE&gt;index=edi-2&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=edi&lt;/CODE&gt; has TRCK and STYPE fields; &lt;CODE&gt;index=edi-2&lt;/CODE&gt; has TRACKINGNUMBER and DATE fields. I want to JOIN (or use an alternative) the two indexex on TRACKINGNUMBER/TRCK and return the count of STYPE. Does that make sense?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 21:29:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mismatch-with-values-in-Join/m-p/392573#M168875</guid>
      <dc:creator>tlunruh</dc:creator>
      <dc:date>2018-06-14T21:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Mismatch with values in Join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mismatch-with-values-in-Join/m-p/704916#M238761</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/121532"&gt;@tlunruh&lt;/a&gt;&amp;nbsp;, it looks like your processing EDI data.&amp;nbsp; We now have solution accelerator for EDI transactions, I would love to share what we have.&amp;nbsp; Let me know if you're interested.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 08:17:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mismatch-with-values-in-Join/m-p/704916#M238761</guid>
      <dc:creator>youngc_splunk</dc:creator>
      <dc:date>2024-11-21T08:17:49Z</dc:date>
    </item>
  </channel>
</rss>

