SEO - Google に検索バーを表示させるには?

The URL of a search in discourse has the following format:

https://your.domain.tld/search?q=test

So I think if you added this to the body of a theme component (the only thing you have to change is your.domain.tld):

<script type="application/ld+json">
{
   "@context": "http://schema.org",
   "@type": "WebSite",
   "url": "https://your.domain.tld/",
   "potentialAction": {
     "@type": "SearchAction",
     "target": "https://your.domain.tld/search?q={search_term_string}",
     "query-input": "required name=search_term_string"
   }
}
</script>

It could eventually work, bear in mind, that in the end only google is deciding if this will show or not, so you could add this code and it would do nothing.