<?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 where is not working with JSON extracted with spath in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/where-is-not-working-with-JSON-extracted-with-spath/m-p/446882#M77743</link>
    <description>&lt;P&gt;Hello there,&lt;/P&gt;

&lt;P&gt;I have the next JSON:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
  "idDeclaracion": "abc123",
  "prospecto": {
    "id": "1111",
    "edad": 24,
    "nombre": "jaime",
    "ubicacion": {
      "direccion": "CL 61",
      "barrio": "Los colores"
    }
  },
  "decisiones": [
    "aprobar",
    "declinar",
    "extraprimar"
  ],
  "exitoso": true
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to filter those events where &lt;CODE&gt;prospecto.id="1111"&lt;/CODE&gt; and i have tried two ways:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;CODE&gt;index=idx_eml_err | spath input=message | search prospecto.id="1111"&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;index=idx_eml_err | spath input=message | where prospecto.id="1111"&lt;/CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Option 1 works well, but option 2 does not. Can somebody please explain me this behavior?&lt;/P&gt;

&lt;P&gt;To have in mind, the next query works well: &lt;CODE&gt;index=idx_eml_err | spath input=message | where idDeclaracion="abc123"&lt;/CODE&gt;. The difference between the last query and &lt;EM&gt;2&lt;/EM&gt;, is that &lt;EM&gt;2&lt;/EM&gt; is using the &lt;CODE&gt;where&lt;/CODE&gt; with a nested field.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 15 Mar 2019 19:19:10 GMT</pubDate>
    <dc:creator>ivykp</dc:creator>
    <dc:date>2019-03-15T19:19:10Z</dc:date>
    <item>
      <title>where is not working with JSON extracted with spath</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/where-is-not-working-with-JSON-extracted-with-spath/m-p/446882#M77743</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;

&lt;P&gt;I have the next JSON:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
  "idDeclaracion": "abc123",
  "prospecto": {
    "id": "1111",
    "edad": 24,
    "nombre": "jaime",
    "ubicacion": {
      "direccion": "CL 61",
      "barrio": "Los colores"
    }
  },
  "decisiones": [
    "aprobar",
    "declinar",
    "extraprimar"
  ],
  "exitoso": true
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to filter those events where &lt;CODE&gt;prospecto.id="1111"&lt;/CODE&gt; and i have tried two ways:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;CODE&gt;index=idx_eml_err | spath input=message | search prospecto.id="1111"&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;index=idx_eml_err | spath input=message | where prospecto.id="1111"&lt;/CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Option 1 works well, but option 2 does not. Can somebody please explain me this behavior?&lt;/P&gt;

&lt;P&gt;To have in mind, the next query works well: &lt;CODE&gt;index=idx_eml_err | spath input=message | where idDeclaracion="abc123"&lt;/CODE&gt;. The difference between the last query and &lt;EM&gt;2&lt;/EM&gt;, is that &lt;EM&gt;2&lt;/EM&gt; is using the &lt;CODE&gt;where&lt;/CODE&gt; with a nested field.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 19:19:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/where-is-not-working-with-JSON-extracted-with-spath/m-p/446882#M77743</guid>
      <dc:creator>ivykp</dc:creator>
      <dc:date>2019-03-15T19:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: where is not working with JSON extracted with spath</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/where-is-not-working-with-JSON-extracted-with-spath/m-p/446883#M77744</link>
      <description>&lt;P&gt;@ivykp,&lt;/P&gt;

&lt;P&gt;This should work for you &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=idx_eml_err | spath input=message |where 'prospecto.id'="1111"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Where"&gt;where&lt;/A&gt; command returns only the results for which the eval expression returns true. These eval-expressions must be Boolean expressions, where the expression returns either true or false. In the json filed, by adding a &lt;CODE&gt;'&lt;/CODE&gt; around the field makes it as literal field name&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2019 06:08:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/where-is-not-working-with-JSON-extracted-with-spath/m-p/446883#M77744</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-03-16T06:08:41Z</dc:date>
    </item>
  </channel>
</rss>

