Document Mustache template support in Search Relevance Workbench - #12810
Document Mustache template support in Search Relevance Workbench#12810Bharathi-Kanna wants to merge 3 commits into
Conversation
Search configurations can now use Mustache template variables ({{query_string}}
and query set custom fields) in the query, in addition to the existing
%SearchText% placeholder. Document the templating behavior, variable sources,
automatic JSON escaping, and that Mustache partials are not supported, with an
example. Also document custom fields on query set entries and how they map to
template variables.
Corresponds to opensearch-project/search-relevance#342.
Signed-off-by: Bharathi-Kanna <99189546+Bharathi-Kanna@users.noreply.github.com>
|
Thank you for submitting your PR. The PR states are In progress (or Draft) -> Tech review -> Doc review -> Merged. Before you submit your PR for doc review, make sure the content is technically accurate. If you need help finding a tech reviewer, tag a maintainer. When you're ready for doc review, tag the assignee of this PR. The doc reviewer may push edits to the PR directly or leave comments and editorial suggestions for you to address (let us know in a comment if you have a preference). |
|
@epugh Could you review this PR? |
|
@Bharathi-Kanna Thanks for the PR! What version is this PR targeting? |
|
|
||
| The following variables are available when a template is rendered: | ||
|
|
||
| * `{{query_string}}`: The `queryText` of the current query set entry. |
There was a problem hiding this comment.
Can we make it to be same as field name from query set?
| * `{{query_string}}`: The `queryText` of the current query set entry. | |
| * `{{queryText}}`: The `queryText` of the current query set entry. |
| PUT _plugins/_search_relevance/search_configurations | ||
| { | ||
| "name": "mustache_filter", | ||
| "query": "{\"query\":{\"bool\":{\"must\":[{\"match\":{\"title\":\"{{query_string}}\"}}],\"filter\":[{\"term\":{\"category\":\"{{category}}\"}}]}}}", |
There was a problem hiding this comment.
| "query": "{\"query\":{\"bool\":{\"must\":[{\"match\":{\"title\":\"{{query_string}}\"}}],\"filter\":[{\"term\":{\"category\":\"{{category}}\"}}]}}}", | |
| "query": "{\"query\":{\"bool\":{\"must\":[{\"match\":{\"title\":\"{{queryText}}\"}}],\"filter\":[{\"term\":{\"category\":\"{{category}}\"}}]}}}", |
|
This doc should not be released until this PR is merged. opensearch-project/search-relevance#342 |
Match the query set field name (queryText) instead of {{query_string}}, per
review feedback on opensearch-project/search-relevance#342.
Signed-off-by: Bharathi-Kanna <99189546+Bharathi-Kanna@users.noreply.github.com>
The PR is merged. It is targeting 3.8. |
|
@Bharathi-Kanna Please let me know once you address tech review comments from Heemin and you have a tech approval, and I'll review the PR from the doc side. Thanks! |
All my comments are addressed. Thanks. |
Search configurations can now use Mustache template variables ({{query_string}} and query set custom fields) in the query, in addition to the existing %SearchText% placeholder. Document the templating behavior, variable sources, automatic JSON escaping, and that Mustache partials are not supported, with an example. Also document custom fields on query set entries and how they map to template variables.
Corresponds to opensearch-project/search-relevance#342.