// This file is autogenerated, DO NOT EDIT // Use `node scripts/generate-docs-examples.js` to generate the docs examples [source, js] ---- const response = await client.searchApplication.put({ name: "my_search_application", search_application: { indices: ["index1", "index2"], template: { script: { lang: "mustache", source: '\n {\n "query": {\n "bool": {\n "should": [\n {{#text}}\n {\n "multi_match": {\n "query": "{{query_string}}",\n "fields": [{{#text_fields}}"{{name}}^{{boost}}",{{/text_fields}}],\n "boost": "{{text_query_boost}}"\n }\n },\n {{/text}}\n {{#elser}}\n {{#elser_fields}}\n {\n "sparse_vector": {\n "field": "ml.inference.{{.}}_expanded.predicted_value",\n "inference_id": "",\n "query": "{{query_string}}"\n }\n },\n {{/elser_fields}}\n { "bool": { "must": [] } },\n {{/elser}}\n {{^text}}\n {{^elser}}\n {\n "query_string": {\n "query": "{{query_string}}",\n "default_field": "{{default_field}}",\n "default_operator": "{{default_operator}}",\n "boost": "{{text_query_boost}}"\n }\n },\n {{/elser}}\n {{/text}}\n { "bool": { "must": [] } }\n ],\n "minimum_should_match": 1\n }\n },\n "min_score": "{{min_score}}",\n "explain": "{{explain}}",\n "from": "{{from}}",\n "size": "{{size}}"\n }\n ', params: { text: false, elser: false, elser_fields: [ { name: "title", boost: 1, }, { name: "description", boost: 1, }, ], text_fields: [ { name: "title", boost: 10, }, { name: "description", boost: 5, }, { name: "state", boost: 1, }, ], query_string: "*", text_query_boost: 4, default_field: "*", default_operator: "OR", explain: false, from: 0, size: 10, min_score: 0, }, }, }, }, }); console.log(response); ----