<?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 Why does the query using an absolute value return better results than the query using a subsearch? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Why-does-the-query-using-an-absolute-value-return-better-results/m-p/320331#M4434</link>
    <description>&lt;P&gt;A query that uses the returned (single) value of a subquery is returning different results than if I simply type in the value as a hard coded string.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Query 1:&lt;/STRONG&gt;&lt;BR /&gt;
index=cfs_* "aeb78KaLh7VIphSVg9FSIxl46y4="&lt;/P&gt;

&lt;P&gt;Returns:&lt;BR /&gt;
- events = 1535&lt;BR /&gt;
- hosts = 5&lt;BR /&gt;
- source = 19&lt;BR /&gt;
- sourcetype = 14&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Query 2:&lt;/STRONG&gt;&lt;BR /&gt;
index=cfs_* [search index=cfs_* "662704824FF6C21E" | top limit=1 sessionId | fields + sessionId]&lt;/P&gt;

&lt;P&gt;Returns:&lt;BR /&gt;
- events = 1331&lt;BR /&gt;
- hosts = 2&lt;BR /&gt;
- source = 10&lt;BR /&gt;
- sourcetypes = 6&lt;/P&gt;

&lt;P&gt;with "[search index=cfs_* "662704824FF6C21E" | top limit=1 sessionId | fields + sessionId]" returning: &lt;EM&gt;aeb78KaLh7VIphSVg9FSIxl46y4=&lt;/EM&gt; when run by itself.&lt;/P&gt;

&lt;P&gt;Why these two different result sets simply because the value returned in Option 2 is from a query vs. a hard coded value?&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 12:59:38 GMT</pubDate>
    <dc:creator>davidse</dc:creator>
    <dc:date>2020-09-29T12:59:38Z</dc:date>
    <item>
      <title>Why does the query using an absolute value return better results than the query using a subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-does-the-query-using-an-absolute-value-return-better-results/m-p/320331#M4434</link>
      <description>&lt;P&gt;A query that uses the returned (single) value of a subquery is returning different results than if I simply type in the value as a hard coded string.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Query 1:&lt;/STRONG&gt;&lt;BR /&gt;
index=cfs_* "aeb78KaLh7VIphSVg9FSIxl46y4="&lt;/P&gt;

&lt;P&gt;Returns:&lt;BR /&gt;
- events = 1535&lt;BR /&gt;
- hosts = 5&lt;BR /&gt;
- source = 19&lt;BR /&gt;
- sourcetype = 14&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Query 2:&lt;/STRONG&gt;&lt;BR /&gt;
index=cfs_* [search index=cfs_* "662704824FF6C21E" | top limit=1 sessionId | fields + sessionId]&lt;/P&gt;

&lt;P&gt;Returns:&lt;BR /&gt;
- events = 1331&lt;BR /&gt;
- hosts = 2&lt;BR /&gt;
- source = 10&lt;BR /&gt;
- sourcetypes = 6&lt;/P&gt;

&lt;P&gt;with "[search index=cfs_* "662704824FF6C21E" | top limit=1 sessionId | fields + sessionId]" returning: &lt;EM&gt;aeb78KaLh7VIphSVg9FSIxl46y4=&lt;/EM&gt; when run by itself.&lt;/P&gt;

&lt;P&gt;Why these two different result sets simply because the value returned in Option 2 is from a query vs. a hard coded value?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:59:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-does-the-query-using-an-absolute-value-return-better-results/m-p/320331#M4434</guid>
      <dc:creator>davidse</dc:creator>
      <dc:date>2020-09-29T12:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the query using an absolute value return better results than the query using a subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-does-the-query-using-an-absolute-value-return-better-results/m-p/320332#M4435</link>
      <description>&lt;P&gt;Answered my own question.   This is the difference between named fields and the value itself in unmapped / un-named / different fields.  This query returns the same results.&lt;/P&gt;

&lt;P&gt;index=cfs_* [search index=cfs_* "662704824FF6C21E" | top limit=1 sessionId | fields + sessionId | rename sessionId as query]&lt;/P&gt;

&lt;P&gt;"query" is dropped by splunk as a keyword, resulting in just the value being used for the subsequent query.   Apparently you can use the "return" macro as well, but I could not get this to work.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:59:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-does-the-query-using-an-absolute-value-return-better-results/m-p/320332#M4435</guid>
      <dc:creator>davidse</dc:creator>
      <dc:date>2020-09-29T12:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the query using an absolute value return better results than the query using a subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-does-the-query-using-an-absolute-value-return-better-results/m-p/320333#M4436</link>
      <description>&lt;P&gt;So your query 1 is this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=cfs_* "aeb78KaLh7VIphSVg9FSIxl46y4="
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The subsearch, when normalized, will be translated as (assuming the value returned is same)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=cfs_* (sessionId="aeb78KaLh7VIphSVg9FSIxl46y4=")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, the subsearch version expects that your data in &lt;CODE&gt;index=cfs_*&lt;/CODE&gt; has a field called sessionId with value "aeb78KaLh7VIphSVg9FSIxl46y4=", whereas the hard-coded value version just searches that the raw data of the events in &lt;CODE&gt;index=cfs_*&lt;/CODE&gt; has word/string "aeb78KaLh7VIphSVg9FSIxl46y4=". There may be events where the string "aeb78KaLh7VIphSVg9FSIxl46y4=" is available but not extracted as field sessionId, and thus the difference. Just to confirm my theory, please run following, for the same time range, and see if it matches your first query's result.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=cfs_* [search index=cfs_* "662704824FF6C21E" | top limit=1 sessionId | eval search=sessionId |table search]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Feb 2017 17:40:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-does-the-query-using-an-absolute-value-return-better-results/m-p/320333#M4436</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-02-20T17:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why does the query using an absolute value return better results than the query using a subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-does-the-query-using-an-absolute-value-return-better-results/m-p/320334#M4437</link>
      <description>&lt;P&gt;Please accept an answer.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 17:53:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-does-the-query-using-an-absolute-value-return-better-results/m-p/320334#M4437</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-02-20T17:53:48Z</dc:date>
    </item>
  </channel>
</rss>

