<?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: Is there a better way to write my search currently using boolean OR operators to make it shorter or more efficient? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-better-way-to-write-my-search-currently-using-boolean/m-p/188967#M54456</link>
    <description>&lt;P&gt;try like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; measInfoId=1174(40551 OR 40572 OR 90518 )

ex:
 index=index1 host=host1 elementType=ET  measInfoId=1174(40551 OR 40572 OR 90518 )
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 19 Mar 2015 12:07:50 GMT</pubDate>
    <dc:creator>fdi01</dc:creator>
    <dc:date>2015-03-19T12:07:50Z</dc:date>
    <item>
      <title>Is there a better way to write my search currently using boolean OR operators to make it shorter or more efficient?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-better-way-to-write-my-search-currently-using-boolean/m-p/188966#M54455</link>
      <description>&lt;P&gt;I have the following search with &lt;CODE&gt;OR&lt;/CODE&gt; operators&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1 host=host1 elementType=ET  measInfoId=117440551 OR measInfoId=117440572 OR measInfoId=117490518 | 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a better way of writing the OR part of this search, be it shorter or more efficient?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;measInfoId=117440551 OR measInfoId=117440572 OR measInfoId=117490518
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Mar 2015 02:02:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-better-way-to-write-my-search-currently-using-boolean/m-p/188966#M54455</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-03-19T02:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a better way to write my search currently using boolean OR operators to make it shorter or more efficient?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-better-way-to-write-my-search-currently-using-boolean/m-p/188967#M54456</link>
      <description>&lt;P&gt;try like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; measInfoId=1174(40551 OR 40572 OR 90518 )

ex:
 index=index1 host=host1 elementType=ET  measInfoId=1174(40551 OR 40572 OR 90518 )
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Mar 2015 12:07:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-better-way-to-write-my-search-currently-using-boolean/m-p/188967#M54456</guid>
      <dc:creator>fdi01</dc:creator>
      <dc:date>2015-03-19T12:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a better way to write my search currently using boolean OR operators to make it shorter or more efficient?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-better-way-to-write-my-search-currently-using-boolean/m-p/188968#M54457</link>
      <description>&lt;P&gt;Tried both these and they did not work&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... measInfoId=1174(40551)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... measInfoId=1174(40551 OR 40572 OR 90518)&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2015 20:11:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-better-way-to-write-my-search-currently-using-boolean/m-p/188968#M54457</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-03-19T20:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a better way to write my search currently using boolean OR operators to make it shorter or more efficient?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-better-way-to-write-my-search-currently-using-boolean/m-p/188969#M54458</link>
      <description>&lt;P&gt;There isn't a quick and easy way to make this perform better / be more efficient.  Splunk's use of boolean AND/OR/NOT is generally very efficient up until you have several thousand terms in your search.&lt;/P&gt;

&lt;P&gt;Syntactically, though, you may want something to sweeten it.  Folks have brought up before the concept of &lt;CODE&gt;field IN (aaa,bbb,ccc)&lt;/CODE&gt; as syntactic sugar around OR.  This doesn't exist though.&lt;/P&gt;

&lt;P&gt;If your list of items is LONG (tens / hundreds) you can make a CSV file and use a lookup, say called &lt;CODE&gt;measInfoId.csv&lt;/CODE&gt; like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;measInfoId
117440551
117440572 
117490518
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And then use the &lt;CODE&gt;inputlookup&lt;/CODE&gt; command to drag it in.  It produces the same long list of &lt;CODE&gt;OR&lt;/CODE&gt; statements just without putting your "O" and "R" keys through such a workout.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=index1 host=host1 elementType=ET [ | inputlookup measInfoId.csv ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Mar 2015 20:31:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-better-way-to-write-my-search-currently-using-boolean/m-p/188969#M54458</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2015-03-19T20:31:02Z</dc:date>
    </item>
  </channel>
</rss>

