// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.mjs` 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                {{#elser_fields}}\n                {\n                  "sparse_vector": {\n                      "field": "ml.inference.{{.}}_expanded.predicted_value",\n                      "inference_id": "<elser_inference_id>",\n                      "query": "{{query_string}}"\n                    }\n                },\n                {{/elser_fields}}\n                ]\n            }\n          },\n          "min_score": "{{min_score}}"\n        }\n        ',
        params: {
          query_string: "*",
          min_score: "10",
          elser_fields: [
            {
              name: "title",
            },
            {
              name: "description",
            },
          ],
        },
      },
    },
  },
});
console.log(response);
----
