Search template with compare equal

Hi
i am trying using search template to compare equal string to return specific records, it looks like this
{{#equals false isJobInProgress}}
,{"bool":{"should":[{"term":{"is_job_in_progress":false}},{"bool":{"must_not":{"exists":{"field":"is_job_in_progress"}}}}]}}
{{/equals}}
{{#equals true isJobInProgress}}
,{"term":{"is_job_in_progress":true}}
{{/equals}}
but it return me error ResponseError: script_exception: [script_exception] Reason: Mismatched start/end tags: equals false isJobInProgress != equals in query-template:1 @[query-template:1], i am not sure the equal is correct syntax ot not , pls help

can you share params?

i think i found out a solution for this already, firstly, the "equals" does not work directly to compare this way, i have to create other params call "equals" in client side and do comparison and return true or fasle.

conditions examples: Search templates | Elasticsearch Guide [8.13] | Elastic

search templates are not great for conditionals and suggest you try and push your logic into the API that calls the search template and provide only params to be replaced in the search template. If you do need conditionals then pass params which are strictly non optional boolean values. This makes it more testable on your side.

Joe