<?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 Issed when search with script from OpenSearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Issed-when-search-with-script-from-OpenSearch/m-p/704123#M238630</link>
    <description>&lt;P&gt;I tried to search data with dynamic script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| ecs "opensearch_dashboards_sample_data_flights" "{
\"from\": 0,
\"size\": 1000,
\"query\": {
\"match_all\": {}
},
\"script_fields\": {
\"fields\": {
\"script\": {
\"source\": \\\"def fields = params['_source'].keySet(); def result = new HashMap(); for (field in fields) { def value = params['_source'][field]; if (value instanceof String &amp;amp;&amp;amp; value.contains('DE')) { result.put(field, value.replace('DE', 'Germany')); } else { result.put(field, value); }} return result;\\\"
}
}
},
\"track_total_hits\": true
}" "only" | table *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it not working. I think the problem is from my source command, but I don't know how to fix this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\"source\": \\\"def fields = params['_source'].keySet(); def result = new HashMap(); for (field in fields) { def value = params['_source'][field]; if (value instanceof String &amp;amp;&amp;amp; value.contains('DE')) { result.put(field, value.replace('DE', 'Germany')); } else { result.put(field, value); }} return result;\\\" &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hope someone can help me fix this. Thank very much for speding tim for my issue.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Nov 2024 03:48:44 GMT</pubDate>
    <dc:creator>kietluu</dc:creator>
    <dc:date>2024-11-12T03:48:44Z</dc:date>
    <item>
      <title>Issed when search with script from OpenSearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issed-when-search-with-script-from-OpenSearch/m-p/704123#M238630</link>
      <description>&lt;P&gt;I tried to search data with dynamic script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| ecs "opensearch_dashboards_sample_data_flights" "{
\"from\": 0,
\"size\": 1000,
\"query\": {
\"match_all\": {}
},
\"script_fields\": {
\"fields\": {
\"script\": {
\"source\": \\\"def fields = params['_source'].keySet(); def result = new HashMap(); for (field in fields) { def value = params['_source'][field]; if (value instanceof String &amp;amp;&amp;amp; value.contains('DE')) { result.put(field, value.replace('DE', 'Germany')); } else { result.put(field, value); }} return result;\\\"
}
}
},
\"track_total_hits\": true
}" "only" | table *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it not working. I think the problem is from my source command, but I don't know how to fix this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\"source\": \\\"def fields = params['_source'].keySet(); def result = new HashMap(); for (field in fields) { def value = params['_source'][field]; if (value instanceof String &amp;amp;&amp;amp; value.contains('DE')) { result.put(field, value.replace('DE', 'Germany')); } else { result.put(field, value); }} return result;\\\" &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hope someone can help me fix this. Thank very much for speding tim for my issue.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 03:48:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issed-when-search-with-script-from-OpenSearch/m-p/704123#M238630</guid>
      <dc:creator>kietluu</dc:creator>
      <dc:date>2024-11-12T03:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Issed when search with script from OpenSearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issed-when-search-with-script-from-OpenSearch/m-p/704125#M238631</link>
      <description>&lt;P&gt;"ecs" is not a native Splunk command. Whatever add-on it came from you need to look in its docs. The only Splunk-related thing is that the string which apparently contains some command for external service must be properly escaped. Other than that it's beyond Splunk realm.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 04:59:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issed-when-search-with-script-from-OpenSearch/m-p/704125#M238631</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-11-12T04:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Issed when search with script from OpenSearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issed-when-search-with-script-from-OpenSearch/m-p/704136#M238632</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 06:46:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issed-when-search-with-script-from-OpenSearch/m-p/704136#M238632</guid>
      <dc:creator>kietluu</dc:creator>
      <dc:date>2024-11-12T06:46:38Z</dc:date>
    </item>
  </channel>
</rss>

