<?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 On understanding array versus multivalue fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/On-understanding-array-versus-multivalue-fields/m-p/628551#M218336</link>
    <description>&lt;P&gt;Greetings. My Splunk instance parses messages which has a JSON array type:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;{ tags: ["info", "foo", "bar"] }&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;Let's say I want to search for events where precisely the second index of the tags field has the value "foo".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Having consulted the Splunk docs, I found&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/SCS/current/Search/Arrayandobjectexpressions" target="_self"&gt;Array and object expressions&lt;/A&gt;&amp;nbsp;. I tried using Array and object expressions, and all of my queries ended poorly&lt;/LI&gt;&lt;LI&gt;Eventually I was pointed to&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.3/SearchReference/MultivalueEvalFunctions" target="_self"&gt;MultivalueEvalFunctions&lt;/A&gt;&amp;nbsp;, which worked.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Using Multivalue fns&amp;nbsp; left me with many questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Why is my JSON array parsed as a multivalue? Why is it not an array?&lt;/LI&gt;&lt;LI&gt;If I execute `typeof('tags')`, I get "Invalid". Why? Shouldn't it be Array or Multivalue?&lt;/LI&gt;&lt;LI&gt;If I execute `typeof('tags{}')`, I get "Multivalue". Why? What did that operator do, and why was it required?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;More or less, as a polyglot programmer with a decade of experience, I found splunk operations on collections to be not just unintuitive, but counter intuitive.&amp;nbsp; Beyond my explicit three question categories above, if compelled, let me know other best-known-practices around searching with array-ish fields &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jan 2023 21:54:33 GMT</pubDate>
    <dc:creator>cdieringerwm</dc:creator>
    <dc:date>2023-01-26T21:54:33Z</dc:date>
    <item>
      <title>On understanding array versus multivalue fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/On-understanding-array-versus-multivalue-fields/m-p/628551#M218336</link>
      <description>&lt;P&gt;Greetings. My Splunk instance parses messages which has a JSON array type:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;{ tags: ["info", "foo", "bar"] }&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;Let's say I want to search for events where precisely the second index of the tags field has the value "foo".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Having consulted the Splunk docs, I found&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/SCS/current/Search/Arrayandobjectexpressions" target="_self"&gt;Array and object expressions&lt;/A&gt;&amp;nbsp;. I tried using Array and object expressions, and all of my queries ended poorly&lt;/LI&gt;&lt;LI&gt;Eventually I was pointed to&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.3/SearchReference/MultivalueEvalFunctions" target="_self"&gt;MultivalueEvalFunctions&lt;/A&gt;&amp;nbsp;, which worked.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Using Multivalue fns&amp;nbsp; left me with many questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Why is my JSON array parsed as a multivalue? Why is it not an array?&lt;/LI&gt;&lt;LI&gt;If I execute `typeof('tags')`, I get "Invalid". Why? Shouldn't it be Array or Multivalue?&lt;/LI&gt;&lt;LI&gt;If I execute `typeof('tags{}')`, I get "Multivalue". Why? What did that operator do, and why was it required?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;More or less, as a polyglot programmer with a decade of experience, I found splunk operations on collections to be not just unintuitive, but counter intuitive.&amp;nbsp; Beyond my explicit three question categories above, if compelled, let me know other best-known-practices around searching with array-ish fields &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 21:54:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/On-understanding-array-versus-multivalue-fields/m-p/628551#M218336</guid>
      <dc:creator>cdieringerwm</dc:creator>
      <dc:date>2023-01-26T21:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: On understanding array versus multivalue fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/On-understanding-array-versus-multivalue-fields/m-p/628552#M218337</link>
      <description>&lt;P&gt;The SCS docs describe SPL2, not the SPL which is used in Splunk Enterprise and Splunk Cloud. In SPL there are no arrays. There are only multivalued fields.&lt;/P&gt;&lt;P&gt;The {} in 'tags{}' is just a part of the name. It's not an operator.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 23:12:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/On-understanding-array-versus-multivalue-fields/m-p/628552#M218337</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-01-26T23:12:10Z</dc:date>
    </item>
  </channel>
</rss>

