The way we can do a SearchAction target is by creating another data item for EntryPoint. Then, within the EntryPoint you add https://query.example.com/search?q={search_term_string} to urlTemplate which expects a string. With the EntryPoint, you can also use actionPlatform to declare searchactions for different devices.

        "potentialAction": {
            "@type": "SearchAction",
            "name": "Search",
            "query-input": "required name=search_term_string",
            "target": {
                "@type": "EntryPoint",
                "urlTemplate": "https://example.com/search?q={search_term_string}",
                "name": "Entry point",
                "actionPlatform": "All",
                "@id": "https://example.com/search#entryPoint"
            },
            "@id": "https://example.com/search#potentialAction"
        },