{"id":72147,"date":"2023-03-30T15:27:32","date_gmt":"2023-03-30T15:27:32","guid":{"rendered":"https:\/\/merikebi.warrenmyers.com\/?p=72147"},"modified":"2023-03-30T15:27:32","modified_gmt":"2023-03-30T15:27:32","slug":"answer-by-warren-for-assigning-a-subsearch-result-to-a-variable","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=72147","title":{"rendered":"Answer by warren for Assigning a subsearch result to a variable"},"content":{"rendered":"<p>I would probably do this as separate searches on the dashboard, unless there was an overwhelming need to have it all in one<\/p>\n<p>Alternatively, you could <code>| append<\/code> each search, &amp; <code>| stats values<\/code> at the ed like this:<\/p>\n<pre><code>index=ndx sourcetype=srctp &quot;middleware 1&quot; &quot;domain1.tld&quot; userid=*\n| stats dc(userid) as domain1users\n| append\n    [| search index=ndx sourcetype=srctp &quot;middleware 2&quot; &quot;domain2.tld&quot; userid=*\n    | stats dc(userid) as domain2users ]\n| stats values(*) as *\n<\/code><\/pre>\n<p>Then in your <code>&lt;done&gt;...&lt;\/done&gt;<\/code> clause, have multiple <code>&lt;set token=&quot;...&quot;&gt;$results.domain{N}users&lt;\/set&gt;<\/code> pairs<\/p>\n<p>from User warren &#8211; Stack Overflow https:\/\/stackoverflow.com\/questions\/75888985\/assigning-a-subsearch-result-to-a-variable\/75890117#75890117<br \/>\nvia <a href=\"https:\/\/ifttt.com\/?ref=da&#038;site=wordpress\">IFTTT<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I would probably do this as separate searches on the dashboard, unless there was an overwhelming need to have it all in one Alternatively, you could | append each search, &amp; | stats values at the ed like this: index=ndx sourcetype=srctp &quot;middleware 1&quot; &quot;domain1.tld&quot; userid=* | stats dc(userid) as domain1users | append [| search index=ndx &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=72147\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Answer by warren for Assigning a subsearch result to a variable<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[991],"keyring_services":[],"class_list":["post-72147","post","type-post","status-publish","format-standard","hentry","category-blih","tag-stackexchange"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/72147","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=72147"}],"version-history":[{"count":1,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/72147\/revisions"}],"predecessor-version":[{"id":72148,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/72147\/revisions\/72148"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=72147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=72147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=72147"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=72147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}